MCPcopy Create free account
hub / github.com/acl-dev/acl / dict_eval

Function dict_eval

lib_dict/src/dict.c:334–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332/* dict_eval - expand embedded dictionary references */
333
334const char *dict_eval(char *dict_name, const char *value, int recursive)
335{
336 const char *myname = "dict_eval";
337 static __thread ACL_VSTRING *buf = NULL;
338 int status;
339
340 /*
341 * Initialize.
342 */
343 if (buf == 0) {
344 buf = acl_vstring_alloc(10);
345 acl_pthread_atexit_add(buf, free_vstring_fn);
346 }
347
348 /*
349 * Expand macros, possibly recursively.
350 */
351#define DONT_FILTER (char *) 0
352
353 status = mac_expand(buf, value,
354 recursive ? MAC_EXP_FLAG_RECURSE : MAC_EXP_FLAG_NONE,
355 DONT_FILTER, dict_eval_lookup, (char *) dict_name);
356 if (status & MAC_PARSE_ERROR)
357 acl_msg_fatal("dictionary %s: macro processing error", dict_name);
358 if (acl_do_debug(DEBUG_DICT, 2)) {
359 if (strcmp(value, STR(buf)) != 0)
360 acl_msg_info("%s: expand %s -> %s", myname, value, STR(buf));
361 else
362 acl_msg_info("%s: const %s", myname, value);
363 }
364 return STR(buf);
365}
366
367/* dict_walk - iterate over all dictionaries in arbitrary order */
368

Callers

nothing calls this directly

Calls 6

acl_vstring_allocFunction · 0.85
acl_pthread_atexit_addFunction · 0.85
mac_expandFunction · 0.85
acl_msg_fatalFunction · 0.85
acl_do_debugFunction · 0.85
acl_msg_infoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…