MCPcopy Create free account
hub / github.com/Entware/Entware / sym_find

Function sym_find

scripts/config/symbol.c:825–850  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

823}
824
825struct symbol *sym_find(const char *name)
826{
827 struct symbol *symbol = NULL;
828 int hash = 0;
829
830 if (!name)
831 return NULL;
832
833 if (name[0] && !name[1]) {
834 switch (name[0]) {
835 case 'y': return &symbol_yes;
836 case 'm': return &symbol_mod;
837 case 'n': return &symbol_no;
838 }
839 }
840 hash = strhash(name) % SYMBOL_HASHSIZE;
841
842 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
843 if (symbol->name &&
844 !strcmp(symbol->name, name) &&
845 !(symbol->flags & SYMBOL_CONST))
846 break;
847 }
848
849 return symbol;
850}
851
852struct sym_match {
853 struct symbol *sym;

Callers 2

conf_read_simpleFunction · 0.85
conf_parseFunction · 0.85

Calls 1

strhashFunction · 0.85

Tested by

no test coverage detected