// SPDX-License-Identifier: GPL-2.0 /* * Implementation of the symbol table type. * * Author : Stephen Smalley, */ #include #include #include #include "symtab.h" static unsigned int symhash(const void *key) { /* * djb2a * Public domain from cdb v0.75 */ unsigned int hash = 5381; unsigned char c; while ((c = *(const unsigned char *)key++)) hash = ((hash << 5) + hash) ^ c; return hash; } static int symcmp(const void *key1, const void *key2) { const char *keyp1, *keyp2; keyp1 = key1; keyp2 = key2; return strcmp(keyp1, keyp2); } static const struct hashtab_key_params symtab_key_params = { .hash = symhash, .cmp = symcmp, }; int symtab_init(struct symtab *s, u32 size) { s->nprim = 0; return hashtab_init(&s->table, size); } int symtab_insert(struct symtab *s, char *name, void *datum) { return hashtab_insert(&s->table, name, datum, symtab_key_params); } void *symtab_search(struct symtab *s, const char *name) { return hashtab_search(&s->table, name, symtab_key_params); } rm> Unnamed repository; edit this file 'description' to name the repository.Russell King
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2020-02-19 10:51:12 -0800
committerDavid S. Miller <davem@davemloft.net>2020-02-19 10:51:12 -0800
commitc3d5e561d6623ab54082b7955f2555b138589e0d (patch)
tree434e09e9b54231b967cfd832b000fb08249bcb80 /drivers/net
parentd631f96dec471fd5f21e8ddeabc520e9259b095f (diff)
parent52ccbdace039480000dc7a4262dabe29f9ea14d5 (diff)
Merge branch 'octeontx2-af-Cleanup-changes'
Sunil Goutham says: ==================== octeontx2-af: Cleanup changes These patches cleanup AF driver by removing unnecessary function exports and cleanup repititive logic. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')