KvConfigGet
Description
Get stored value for key as a new Str copy.
Parameters
| Name | Direction | Description |
|---|---|---|
cfg |
in,out | Parsed config. |
key |
in | Lookup key. Prefer Str *; Zstr accepted. |
Success
Newly allocated copy of stored Str value. Caller must StrDeinit(...) it.
Failure
Empty Str if key does not exist.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Parse.c:384:
stored_host = KvConfigGetPtr(&cfg, "host");
host_copy = KvConfigGet(&cfg, "host");
result = result && stored_host;- In
Parse.c:535:
// get copy via Str*
Str got = KvConfigGet(&cfg, &k_name);
result = result && (StrCmp(&got, "misra") == 0);
StrDeinit(&got);
Last updated on