From 4a6b99649a641f98d1d740b8dfd916f2e7ee3085 Mon Sep 17 00:00:00 2001 From: ame Date: Mon, 4 Mar 2024 12:21:56 -0600 Subject: parser almost done --- src/types/parray.c | 2 +- src/types/str.c | 5 +++++ src/types/str.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/types') diff --git a/src/types/parray.c b/src/types/parray.c index 9066425..a1109c5 100644 --- a/src/types/parray.c +++ b/src/types/parray.c @@ -41,7 +41,7 @@ parray_t* parray_init(){ void parray_set(parray_t* p, char* key, void* value){ for(int i = 0; i != p->len; i++){ if(strcmp(p->P[i].key->c, key) == 0){ - p->P[p->len - 1].value = value; + p->P[i].value = value; return; } } diff --git a/src/types/str.c b/src/types/str.c index 12a6bb1..bfedd87 100644 --- a/src/types/str.c +++ b/src/types/str.c @@ -53,4 +53,9 @@ void str_popf(str* s, int len){ s->c[s->len] = 0; } +void str_popb(str* s, int len){ + s->len -= len; + s->c[s->len] = 0; +} + diff --git a/src/types/str.h b/src/types/str.h index 54f27e6..20383c8 100644 --- a/src/types/str.h +++ b/src/types/str.h @@ -17,4 +17,5 @@ void str_push(str*, char*); void str_pushl(str*, char*, size_t); void str_clear(str*); void str_popf(str*, int); +void str_popb(str*, int); #endif //__STR_H \ No newline at end of file -- cgit v1.2.3