snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 951e6b23151d298d9babeec81bc9926c11bdb3b3
parent 91bb0615d982d1adcc5680c346f9510905464584
Author: default <nobody@localhost>
Date:   Sat,  9 Mar 2024 08:58:43 +0100

Replaced all xs_dict_iter() with xs_dict_next().

Diffstat:
Mhttp.c | 3++-
Mxs.h | 3+++
2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/http.c b/http.c @@ -77,7 +77,8 @@ xs_dict *http_signed_request_raw(const char *keyid, const char *seckey, /* transfer the original headers */ hdrs = xs_dict_new(); - while (xs_dict_iter(&headers, &k, &v)) + int c = 0; + while (xs_dict_next(headers, &k, &v, &c)) hdrs = xs_dict_append(hdrs, k, v); /* add the new headers */ diff --git a/xs.h b/xs.h @@ -1028,6 +1028,9 @@ int xs_dict_iter(xs_dict **dict, xs_str **key, xs_val **value) int xs_dict_next(const xs_dict *dict, xs_str **key, xs_val **value, int *ctxt) /* iterates a dict, with context */ { + if (xs_type(dict) != XSTYPE_DICT) + return 0; + int goon = 1; char *p = (char *)dict;