diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2020-03-11 17:54:19 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2020-03-11 17:54:19 +0300 |
commit | 8f1e6faa7f548c9a8bcbcac71c8f239a6540b926 (patch) | |
tree | dd5dfec60de8e52472fe8db2b5ae66010d5dc1d3 /src/param.c | |
parent | 5cfe6cdf6af2d630d21871f9193fc1b4a7db24ff (diff) | |
download | magi-8f1e6faa7f548c9a8bcbcac71c8f239a6540b926.tar magi-8f1e6faa7f548c9a8bcbcac71c8f239a6540b926.tar.xz magi-8f1e6faa7f548c9a8bcbcac71c8f239a6540b926.zip |
[magi]
Diffstat (limited to 'src/param.c')
-rw-r--r-- | src/param.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/param.c b/src/param.c index 42785fc..dd89a48 100644 --- a/src/param.c +++ b/src/param.c @@ -10,7 +10,18 @@ void magi_params_add(magi_params **params, magi_param *newitem) if (node) { node->next = *params; node->item = *newitem; - *params = node; + *params = node; + } +} + +void magi_params_set(magi_params **params, magi_param *newitem) +{ + if (!*params) { + magi_params_add(params, newitem); + } else if (!strcmp((*params)->item.name, newitem->name)) { + (*params)->item.data = newitem->data; + } else { + magi_params_set(&(*params)->next, newitem); } } |