aboutsummaryrefslogtreecommitdiffstats
path: root/src/subst.c
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2024-01-05 14:39:43 -0600
committerLibravatar bigfoot547 <[email protected]>2024-01-05 14:39:43 -0600
commit04b429d064fb2954e768abc8066013ad0faf2729 (patch)
tree55ab857300a3323c908d52fc1307e2c672f60bc8 /src/subst.c
parentextracts natives (diff)
launch info all in one place
TODO: build class path
Diffstat (limited to 'src/subst.c')
-rw-r--r--src/subst.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/subst.c b/src/subst.c
index 6c8bec6..20a6790 100644
--- a/src/subst.c
+++ b/src/subst.c
@@ -6,6 +6,7 @@
struct l2_subst__item {
char *name;
char *value;
+ size_t namelen;
struct l2_subst__item *next;
};
@@ -46,6 +47,7 @@ int l2_subst_add(l2_subst_t *sp, const char *name, const char *value)
item->name = namedup;
item->value = valdup;
+ item->namelen = strlen(name);
item->next = sp->items;
sp->items = item;
@@ -55,7 +57,7 @@ int l2_subst_add(l2_subst_t *sp, const char *name, const char *value)
const char *l2_subst__find(l2_subst_t *sp, const char *name, size_t len)
{
for (struct l2_subst__item *item = sp->items; item; item = item->next) {
- if (!strncmp(item->name, name, len)) return item->value;
+ if (item->namelen == len && !strncmp(item->name, name, len)) return item->value;
}
return NULL;
}