| 239 | |
| 240 | |
| 241 | static tpl_tcell_t* tpl_produce_section(tpl_t *tpl, |
| 242 | const char* key, |
| 243 | int key_len, |
| 244 | int must_create) |
| 245 | { |
| 246 | tpl_tcell_t **psection = &tpl->sections[tpl_hash(key, key_len)]; |
| 247 | |
| 248 | while (*psection != NULL) |
| 249 | { |
| 250 | if (memcmp((*psection)->key, key, key_len) == 0) |
| 251 | return (must_create) ? NULL : *psection; |
| 252 | |
| 253 | psection = &(*psection)->_next; |
| 254 | } |
| 255 | if (*psection == NULL && must_create) |
| 256 | { |
| 257 | *psection = create_tcell(key, key_len); |
| 258 | (*psection)->tpl->parent = tpl; |
| 259 | return *psection; |
| 260 | } |
| 261 | |
| 262 | return NULL; |
| 263 | } |
| 264 | |
| 265 | #define tpl_get_section(tpl, key) \ |
| 266 | tpl_produce_section(tpl, key, (int) strlen(key), 0) |
nothing calls this directly
no test coverage detected
searching dependent graphs…