162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * A symbol table (symtab) maintains associations between symbol 462306a36Sopenharmony_ci * strings and datum values. The type of the datum values 562306a36Sopenharmony_ci * is arbitrary. The symbol table type is implemented 662306a36Sopenharmony_ci * using the hash table type (hashtab). 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Author : Stephen Smalley, <stephen.smalley.work@gmail.com> 962306a36Sopenharmony_ci */ 1062306a36Sopenharmony_ci#ifndef _SS_SYMTAB_H_ 1162306a36Sopenharmony_ci#define _SS_SYMTAB_H_ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include "hashtab.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cistruct symtab { 1662306a36Sopenharmony_ci struct hashtab table; /* hash table (keyed on a string) */ 1762306a36Sopenharmony_ci u32 nprim; /* number of primary names in table */ 1862306a36Sopenharmony_ci}; 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciint symtab_init(struct symtab *s, u32 size); 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciint symtab_insert(struct symtab *s, char *name, void *datum); 2362306a36Sopenharmony_civoid *symtab_search(struct symtab *s, const char *name); 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#endif /* _SS_SYMTAB_H_ */ 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_ci 28