version 1.8, 2011/11/02 12:09:25 |
version 1.9, 2017/01/11 20:53:52 |
|
|
_ti_${name}id(ssize_t idx) |
_ti_${name}id(ssize_t idx) |
{ |
{ |
|
|
if ((size_t)idx > __arraycount(_ti_${name}ids)) |
if ((size_t)idx >= __arraycount(_ti_${name}ids)) |
return NULL; |
return NULL; |
return _ti_${name}ids[idx]; |
return _ti_${name}ids[idx]; |
} |
} |
Line 76 _ti_${name}index(const char *key) |
|
Line 76 _ti_${name}index(const char *key) |
|
uint32_t idx; |
uint32_t idx; |
|
|
idx = _ti_${name}hash((const unsigned char *)key, strlen(key)); |
idx = _ti_${name}hash((const unsigned char *)key, strlen(key)); |
if (idx > __arraycount(_ti_${name}ids) || |
if (idx >= __arraycount(_ti_${name}ids) || |
strcmp(key, _ti_${name}ids[idx]) != 0) |
strcmp(key, _ti_${name}ids[idx]) != 0) |
return -1; |
return -1; |
return idx; |
return idx; |