diff --git a/snac.c b/snac.c index dd76e06..3ba3d38 100644 --- a/snac.c +++ b/snac.c @@ -113,7 +113,7 @@ int check_password(char *uid, char *passwd, char *hash) /* checks a password */ { int ret = 0; - xs *spl = xs_splitn(hash, ":", 1); + xs *spl = xs_split_n(hash, ":", 1); if (xs_list_len(spl) == 2) { xs *n_hash = hash_password(uid, passwd, xs_list_get(spl, 0)); diff --git a/xs.h b/xs.h index b4a77d0..fe8d78b 100644 --- a/xs.h +++ b/xs.h @@ -65,8 +65,8 @@ int xs_list_len(char *list); char *xs_list_get(char *list, int num); int xs_list_in(char *list, char *val); d_char *xs_join(char *list, const char *sep); -d_char *xs_splitn(const char *str, const char *sep, int times); -#define xs_split(str, sep) xs_splitn(str, sep, 0xfffffff) +d_char *xs_split_n(const char *str, const char *sep, int times); +#define xs_split(str, sep) xs_split_n(str, sep, 0xfffffff) d_char *xs_dict_new(void); d_char *xs_dict_append_m(d_char *dict, const char *key, const char *mem, int dsz); #define xs_dict_append(dict, key, data) xs_dict_append_m(dict, key, data, xs_size(data)) @@ -527,7 +527,7 @@ d_char *xs_join(char *list, const char *sep) } -d_char *xs_splitn(const char *str, const char *sep, int times) +d_char *xs_split_n(const char *str, const char *sep, int times) /* splits a string into a list upto n times */ { int sz = strlen(sep); diff --git a/xs_curl.h b/xs_curl.h index 01d9311..3c6e3c5 100644 --- a/xs_curl.h +++ b/xs_curl.h @@ -25,7 +25,7 @@ static size_t _header_callback(char *buffer, size_t size, /* only the HTTP/x 200 line and the last one doesn't have ': ' */ if (xs_str_in(l, ": ") != -1) { - xs *knv = xs_splitn(l, ": ", 1); + xs *knv = xs_split_n(l, ": ", 1); headers = xs_dict_append(headers, xs_list_get(knv, 0), xs_list_get(knv, 1)); } diff --git a/xs_httpd.h b/xs_httpd.h index 3d520ec..d15a473 100644 --- a/xs_httpd.h +++ b/xs_httpd.h @@ -57,7 +57,7 @@ d_char *xs_url_vars(char *str) l = args; while (xs_list_iter(&l, &v)) { - xs *kv = xs_splitn(v, "=", 2); + xs *kv = xs_split_n(v, "=", 2); if (xs_list_len(kv) == 2) vars = xs_dict_append(vars, @@ -98,7 +98,7 @@ d_char *xs_httpd_request(FILE *f) { /* split the path with its optional variables */ xs *udp = xs_url_dec(xs_list_get(l2, 1)); - xs *pnv = xs_splitn(udp, "?", 1); + xs *pnv = xs_split_n(udp, "?", 1); /* store the path */ headers = xs_dict_append(headers, "path", xs_list_get(pnv, 0)); @@ -118,7 +118,7 @@ d_char *xs_httpd_request(FILE *f) break; /* split header and content */ - p = xs_splitn(l, ": ", 1); + p = xs_split_n(l, ": ", 1); if (xs_list_len(p) == 2) headers = xs_dict_append(headers,