summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--snac.c2
-rw-r--r--xs.h6
-rw-r--r--xs_curl.h2
-rw-r--r--xs_httpd.h6
4 files changed, 8 insertions, 8 deletions
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)
113/* checks a password */ 113/* checks a password */
114{ 114{
115 int ret = 0; 115 int ret = 0;
116 xs *spl = xs_splitn(hash, ":", 1); 116 xs *spl = xs_split_n(hash, ":", 1);
117 117
118 if (xs_list_len(spl) == 2) { 118 if (xs_list_len(spl) == 2) {
119 xs *n_hash = hash_password(uid, passwd, xs_list_get(spl, 0)); 119 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);
65char *xs_list_get(char *list, int num); 65char *xs_list_get(char *list, int num);
66int xs_list_in(char *list, char *val); 66int xs_list_in(char *list, char *val);
67d_char *xs_join(char *list, const char *sep); 67d_char *xs_join(char *list, const char *sep);
68d_char *xs_splitn(const char *str, const char *sep, int times); 68d_char *xs_split_n(const char *str, const char *sep, int times);
69#define xs_split(str, sep) xs_splitn(str, sep, 0xfffffff) 69#define xs_split(str, sep) xs_split_n(str, sep, 0xfffffff)
70d_char *xs_dict_new(void); 70d_char *xs_dict_new(void);
71d_char *xs_dict_append_m(d_char *dict, const char *key, const char *mem, int dsz); 71d_char *xs_dict_append_m(d_char *dict, const char *key, const char *mem, int dsz);
72#define xs_dict_append(dict, key, data) xs_dict_append_m(dict, key, data, xs_size(data)) 72#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)
527} 527}
528 528
529 529
530d_char *xs_splitn(const char *str, const char *sep, int times) 530d_char *xs_split_n(const char *str, const char *sep, int times)
531/* splits a string into a list upto n times */ 531/* splits a string into a list upto n times */
532{ 532{
533 int sz = strlen(sep); 533 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,
25 25
26 /* only the HTTP/x 200 line and the last one doesn't have ': ' */ 26 /* only the HTTP/x 200 line and the last one doesn't have ': ' */
27 if (xs_str_in(l, ": ") != -1) { 27 if (xs_str_in(l, ": ") != -1) {
28 xs *knv = xs_splitn(l, ": ", 1); 28 xs *knv = xs_split_n(l, ": ", 1);
29 29
30 headers = xs_dict_append(headers, xs_list_get(knv, 0), xs_list_get(knv, 1)); 30 headers = xs_dict_append(headers, xs_list_get(knv, 0), xs_list_get(knv, 1));
31 } 31 }
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)
57 57
58 l = args; 58 l = args;
59 while (xs_list_iter(&l, &v)) { 59 while (xs_list_iter(&l, &v)) {
60 xs *kv = xs_splitn(v, "=", 2); 60 xs *kv = xs_split_n(v, "=", 2);
61 61
62 if (xs_list_len(kv) == 2) 62 if (xs_list_len(kv) == 2)
63 vars = xs_dict_append(vars, 63 vars = xs_dict_append(vars,
@@ -98,7 +98,7 @@ d_char *xs_httpd_request(FILE *f)
98 { 98 {
99 /* split the path with its optional variables */ 99 /* split the path with its optional variables */
100 xs *udp = xs_url_dec(xs_list_get(l2, 1)); 100 xs *udp = xs_url_dec(xs_list_get(l2, 1));
101 xs *pnv = xs_splitn(udp, "?", 1); 101 xs *pnv = xs_split_n(udp, "?", 1);
102 102
103 /* store the path */ 103 /* store the path */
104 headers = xs_dict_append(headers, "path", xs_list_get(pnv, 0)); 104 headers = xs_dict_append(headers, "path", xs_list_get(pnv, 0));
@@ -118,7 +118,7 @@ d_char *xs_httpd_request(FILE *f)
118 break; 118 break;
119 119
120 /* split header and content */ 120 /* split header and content */
121 p = xs_splitn(l, ": ", 1); 121 p = xs_split_n(l, ": ", 1);
122 122
123 if (xs_list_len(p) == 2) 123 if (xs_list_len(p) == 2)
124 headers = xs_dict_append(headers, 124 headers = xs_dict_append(headers,