[PATCH libxkbcommon v2 1/2] makekeys: use GNU gperf to generate perfect hashtables

David Herrmann dh.herrmann at googlemail.com
Thu Oct 4 08:03:27 PDT 2012


And one minor style-fix below:

On Thu, Oct 4, 2012 at 4:58 PM, David Herrmann
<dh.herrmann at googlemail.com> wrote:
>>  #include "xkbcommon/xkbcommon.h"
>>  #include "utils.h"
>> -#include "ks_tables.h"
>>  #include "keysym.h"
>> +#include "ks_tables.h"
>> +
>> +static int compare_by_keysym(const void *a, const void *b)
>> +{
>> +    const struct name_keysym *key = a, *entry = b;
>> +    if (key->keysym < entry->keysym)
>> +        return -1;
>> +    if (key->keysym > entry->keysym)
>> +        return 1;
>> +    return 0;
>> +}
>> +
>> +static int compare_by_name(const void *a, const void *b)
>> +{
>> +    const struct name_keysym *key = a, *entry = b;
>> +    return strcmp(key->name, entry->name);
>> +}
>> +

Drop that double-newline. One empty line is enough.

>>
>>  XKB_EXPORT int
>>  xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size)
>>  {
>> -    int i, n, h, idx;
>> -    const unsigned char *entry;
>> -    unsigned char val1, val2, val3, val4;
>> +    const struct name_keysym search = { .name = NULL, .keysym = ks };
>> +    const struct name_keysym *entry;
>>


More information about the wayland-devel mailing list