replacing if-then-else strcmp ladders with switch cases

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



considering  lib/dynamic_debug.c
we have

...
} else if (!strcmp(words[i], "module")) {
    rc = check_set(&query->module, words[i+1], "module");
} else if (!strcmp(words[i], "format")) {
...

are there any built-in hash functions which would allow this ?

switch (keyword) {
case Hash("module"):
    ..... break;
case Hash("format"):
    .... break;
default: return -EINVAL
}

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux