diff options
| -rw-r--r-- | activitypub.c | 4 | ||||
| -rw-r--r-- | data.c | 20 | ||||
| -rw-r--r-- | html.c | 4 | ||||
| -rw-r--r-- | main.c | 16 | ||||
| -rw-r--r-- | mastoapi.c | 40 | ||||
| -rw-r--r-- | upgrade.c | 2 | ||||
| -rw-r--r-- | utils.c | 8 | ||||
| -rw-r--r-- | webfinger.c | 2 | ||||
| -rw-r--r-- | xs_json.h | 10 | ||||
| -rw-r--r-- | xs_version.h | 2 |
10 files changed, 54 insertions, 54 deletions
diff --git a/activitypub.c b/activitypub.c index 1fb09c6..fdccf1c 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -294,7 +294,7 @@ int send_to_inbox_raw(const char *keyid, const char *seckey, | |||
| 294 | { | 294 | { |
| 295 | int status; | 295 | int status; |
| 296 | xs_dict *response; | 296 | xs_dict *response; |
| 297 | xs *j_msg = xs_json_dumps_pp((xs_dict *)msg, 4); | 297 | xs *j_msg = xs_json_dumps((xs_dict *)msg, 4); |
| 298 | 298 | ||
| 299 | response = http_signed_request_raw(keyid, seckey, "POST", inbox, | 299 | response = http_signed_request_raw(keyid, seckey, "POST", inbox, |
| 300 | NULL, j_msg, strlen(j_msg), &status, payload, p_size, timeout); | 300 | NULL, j_msg, strlen(j_msg), &status, payload, p_size, timeout); |
| @@ -2028,7 +2028,7 @@ int activitypub_get_handler(const xs_dict *req, const char *q_path, | |||
| 2028 | status = 404; | 2028 | status = 404; |
| 2029 | 2029 | ||
| 2030 | if (status == 200 && msg != NULL) { | 2030 | if (status == 200 && msg != NULL) { |
| 2031 | *body = xs_json_dumps_pp(msg, 4); | 2031 | *body = xs_json_dumps(msg, 4); |
| 2032 | *b_size = strlen(*body); | 2032 | *b_size = strlen(*body); |
| 2033 | } | 2033 | } |
| 2034 | 2034 | ||
| @@ -632,7 +632,7 @@ int _object_add(const char *id, const xs_dict *obj, int ow) | |||
| 632 | if ((f = fopen(fn, "w")) != NULL) { | 632 | if ((f = fopen(fn, "w")) != NULL) { |
| 633 | flock(fileno(f), LOCK_EX); | 633 | flock(fileno(f), LOCK_EX); |
| 634 | 634 | ||
| 635 | xs_json_dump_pp(obj, 4, f); | 635 | xs_json_dump(obj, 4, f); |
| 636 | fclose(f); | 636 | fclose(f); |
| 637 | 637 | ||
| 638 | /* does this object has a parent? */ | 638 | /* does this object has a parent? */ |
| @@ -1175,7 +1175,7 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg) | |||
| 1175 | FILE *f; | 1175 | FILE *f; |
| 1176 | 1176 | ||
| 1177 | if ((f = fopen(fn, "w")) != NULL) { | 1177 | if ((f = fopen(fn, "w")) != NULL) { |
| 1178 | xs_json_dump_pp(msg, 4, f); | 1178 | xs_json_dump(msg, 4, f); |
| 1179 | fclose(f); | 1179 | fclose(f); |
| 1180 | 1180 | ||
| 1181 | /* get the filename of the actor object */ | 1181 | /* get the filename of the actor object */ |
| @@ -1913,7 +1913,7 @@ void notify_add(snac *snac, const char *type, const char *utype, | |||
| 1913 | noti = xs_dict_append(noti, "objid", objid); | 1913 | noti = xs_dict_append(noti, "objid", objid); |
| 1914 | 1914 | ||
| 1915 | if ((f = fopen(fn, "w")) != NULL) { | 1915 | if ((f = fopen(fn, "w")) != NULL) { |
| 1916 | xs_json_dump_pp(noti, 4, f); | 1916 | xs_json_dump(noti, 4, f); |
| 1917 | fclose(f); | 1917 | fclose(f); |
| 1918 | } | 1918 | } |
| 1919 | } | 1919 | } |
| @@ -1986,7 +1986,7 @@ static xs_dict *_enqueue_put(const char *fn, xs_dict *msg) | |||
| 1986 | FILE *f; | 1986 | FILE *f; |
| 1987 | 1987 | ||
| 1988 | if ((f = fopen(tfn, "w")) != NULL) { | 1988 | if ((f = fopen(tfn, "w")) != NULL) { |
| 1989 | xs_json_dump_pp(msg, 4, f); | 1989 | xs_json_dump(msg, 4, f); |
| 1990 | fclose(f); | 1990 | fclose(f); |
| 1991 | 1991 | ||
| 1992 | rename(tfn, fn); | 1992 | rename(tfn, fn); |
| @@ -2484,8 +2484,8 @@ void srv_archive(const char *direction, const char *url, xs_dict *req, | |||
| 2484 | xs *meta_fn = xs_fmt("%s/_META", dir); | 2484 | xs *meta_fn = xs_fmt("%s/_META", dir); |
| 2485 | 2485 | ||
| 2486 | if ((f = fopen(meta_fn, "w")) != NULL) { | 2486 | if ((f = fopen(meta_fn, "w")) != NULL) { |
| 2487 | xs *j1 = xs_json_dumps_pp(req, 4); | 2487 | xs *j1 = xs_json_dumps(req, 4); |
| 2488 | xs *j2 = xs_json_dumps_pp(headers, 4); | 2488 | xs *j2 = xs_json_dumps(headers, 4); |
| 2489 | 2489 | ||
| 2490 | fprintf(f, "dir: %s\n", direction); | 2490 | fprintf(f, "dir: %s\n", direction); |
| 2491 | 2491 | ||
| @@ -2513,7 +2513,7 @@ void srv_archive(const char *direction, const char *url, xs_dict *req, | |||
| 2513 | xs *j1 = NULL; | 2513 | xs *j1 = NULL; |
| 2514 | 2514 | ||
| 2515 | if (v1 != NULL) | 2515 | if (v1 != NULL) |
| 2516 | j1 = xs_json_dumps_pp(v1, 4); | 2516 | j1 = xs_json_dumps(v1, 4); |
| 2517 | 2517 | ||
| 2518 | if (j1 != NULL) | 2518 | if (j1 != NULL) |
| 2519 | fwrite(j1, strlen(j1), 1, f); | 2519 | fwrite(j1, strlen(j1), 1, f); |
| @@ -2544,7 +2544,7 @@ void srv_archive(const char *direction, const char *url, xs_dict *req, | |||
| 2544 | xs *j1 = NULL; | 2544 | xs *j1 = NULL; |
| 2545 | 2545 | ||
| 2546 | if (v1 != NULL) | 2546 | if (v1 != NULL) |
| 2547 | j1 = xs_json_dumps_pp(v1, 4); | 2547 | j1 = xs_json_dumps(v1, 4); |
| 2548 | 2548 | ||
| 2549 | if (j1 != NULL) | 2549 | if (j1 != NULL) |
| 2550 | fwrite(j1, strlen(j1), 1, f); | 2550 | fwrite(j1, strlen(j1), 1, f); |
| @@ -2581,7 +2581,7 @@ void srv_archive_error(const char *prefix, const xs_str *err, | |||
| 2581 | if (req) { | 2581 | if (req) { |
| 2582 | fprintf(f, "Request headers:\n"); | 2582 | fprintf(f, "Request headers:\n"); |
| 2583 | 2583 | ||
| 2584 | xs_json_dump_pp(req, 4, f); | 2584 | xs_json_dump(req, 4, f); |
| 2585 | 2585 | ||
| 2586 | fprintf(f, "\n"); | 2586 | fprintf(f, "\n"); |
| 2587 | } | 2587 | } |
| @@ -2590,7 +2590,7 @@ void srv_archive_error(const char *prefix, const xs_str *err, | |||
| 2590 | fprintf(f, "Data:\n"); | 2590 | fprintf(f, "Data:\n"); |
| 2591 | 2591 | ||
| 2592 | if (xs_type(data) == XSTYPE_LIST || xs_type(data) == XSTYPE_DICT) { | 2592 | if (xs_type(data) == XSTYPE_LIST || xs_type(data) == XSTYPE_DICT) { |
| 2593 | xs_json_dump_pp(data, 4, f); | 2593 | xs_json_dump(data, 4, f); |
| 2594 | } | 2594 | } |
| 2595 | else | 2595 | else |
| 2596 | fprintf(f, "%s", data); | 2596 | fprintf(f, "%s", data); |
| @@ -1990,7 +1990,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 1990 | p_vars = xs_dict_get(req, "p_vars"); | 1990 | p_vars = xs_dict_get(req, "p_vars"); |
| 1991 | 1991 | ||
| 1992 | #if 0 | 1992 | #if 0 |
| 1993 | xs_json_dump_pp(p_vars, 4, stdout); | 1993 | xs_json_dump(p_vars, 4, stdout); |
| 1994 | #endif | 1994 | #endif |
| 1995 | 1995 | ||
| 1996 | if (p_path && strcmp(p_path, "admin/note") == 0) { /** **/ | 1996 | if (p_path && strcmp(p_path, "admin/note") == 0) { /** **/ |
| @@ -2312,7 +2312,7 @@ int html_post_handler(const xs_dict *req, const char *q_path, | |||
| 2312 | rename(fn, bfn); | 2312 | rename(fn, bfn); |
| 2313 | 2313 | ||
| 2314 | if ((f = fopen(fn, "w")) != NULL) { | 2314 | if ((f = fopen(fn, "w")) != NULL) { |
| 2315 | xs_json_dump_pp(snac.config, 4, f); | 2315 | xs_json_dump(snac.config, 4, f); |
| 2316 | fclose(f); | 2316 | fclose(f); |
| 2317 | } | 2317 | } |
| 2318 | else | 2318 | else |
| @@ -200,7 +200,7 @@ int main(int argc, char *argv[]) | |||
| 200 | xs *list = index_list_desc(idx, 0, 256); | 200 | xs *list = index_list_desc(idx, 0, 256); |
| 201 | xs *tl = timeline_top_level(&snac, list); | 201 | xs *tl = timeline_top_level(&snac, list); |
| 202 | 202 | ||
| 203 | xs_json_dump_pp(tl, 4, stdout); | 203 | xs_json_dump(tl, 4, stdout); |
| 204 | 204 | ||
| 205 | return 0; | 205 | return 0; |
| 206 | } | 206 | } |
| @@ -231,7 +231,7 @@ int main(int argc, char *argv[]) | |||
| 231 | enqueue_message(&snac, msg); | 231 | enqueue_message(&snac, msg); |
| 232 | 232 | ||
| 233 | if (dbglevel) { | 233 | if (dbglevel) { |
| 234 | xs_json_dump_pp(msg, 4, stdout); | 234 | xs_json_dump(msg, 4, stdout); |
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | 237 | ||
| @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) | |||
| 249 | enqueue_output_by_actor(&snac, msg, actor, 0); | 249 | enqueue_output_by_actor(&snac, msg, actor, 0); |
| 250 | 250 | ||
| 251 | if (dbglevel) { | 251 | if (dbglevel) { |
| 252 | xs_json_dump_pp(msg, 4, stdout); | 252 | xs_json_dump(msg, 4, stdout); |
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | 255 | ||
| @@ -311,7 +311,7 @@ int main(int argc, char *argv[]) | |||
| 311 | enqueue_output_by_actor(&snac, msg, url, 0); | 311 | enqueue_output_by_actor(&snac, msg, url, 0); |
| 312 | 312 | ||
| 313 | if (dbglevel) { | 313 | if (dbglevel) { |
| 314 | xs_json_dump_pp(msg, 4, stdout); | 314 | xs_json_dump(msg, 4, stdout); |
| 315 | } | 315 | } |
| 316 | } | 316 | } |
| 317 | else { | 317 | else { |
| @@ -350,7 +350,7 @@ int main(int argc, char *argv[]) | |||
| 350 | xs *c_msg = msg_create(&snac, msg); | 350 | xs *c_msg = msg_create(&snac, msg); |
| 351 | 351 | ||
| 352 | if (dbglevel) { | 352 | if (dbglevel) { |
| 353 | xs_json_dump_pp(c_msg, 4, stdout); | 353 | xs_json_dump(c_msg, 4, stdout); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | enqueue_message(&snac, c_msg); | 356 | enqueue_message(&snac, c_msg); |
| @@ -370,7 +370,7 @@ int main(int argc, char *argv[]) | |||
| 370 | printf("status: %d\n", status); | 370 | printf("status: %d\n", status); |
| 371 | 371 | ||
| 372 | if (data != NULL) { | 372 | if (data != NULL) { |
| 373 | xs_json_dump_pp(data, 4, stdout); | 373 | xs_json_dump(data, 4, stdout); |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | return 0; | 376 | return 0; |
| @@ -385,7 +385,7 @@ int main(int argc, char *argv[]) | |||
| 385 | printf("status: %d\n", status); | 385 | printf("status: %d\n", status); |
| 386 | 386 | ||
| 387 | if (valid_status(status)) { | 387 | if (valid_status(status)) { |
| 388 | xs_json_dump_pp(data, 4, stdout); | 388 | xs_json_dump(data, 4, stdout); |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | return 0; | 391 | return 0; |
| @@ -428,7 +428,7 @@ int main(int argc, char *argv[]) | |||
| 428 | c_msg = msg_create(&snac, msg); | 428 | c_msg = msg_create(&snac, msg); |
| 429 | 429 | ||
| 430 | if (dbglevel) { | 430 | if (dbglevel) { |
| 431 | xs_json_dump_pp(c_msg, 4, stdout); | 431 | xs_json_dump(c_msg, 4, stdout); |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | enqueue_message(&snac, c_msg); | 434 | enqueue_message(&snac, c_msg); |
| @@ -39,7 +39,7 @@ int app_add(const char *id, const xs_dict *app) | |||
| 39 | fn = xs_str_cat(fn, ".json"); | 39 | fn = xs_str_cat(fn, ".json"); |
| 40 | 40 | ||
| 41 | if ((f = fopen(fn, "w")) != NULL) { | 41 | if ((f = fopen(fn, "w")) != NULL) { |
| 42 | xs_json_dump_pp(app, 4, f); | 42 | xs_json_dump(app, 4, f); |
| 43 | fclose(f); | 43 | fclose(f); |
| 44 | } | 44 | } |
| 45 | else | 45 | else |
| @@ -102,7 +102,7 @@ int token_add(const char *id, const xs_dict *token) | |||
| 102 | fn = xs_str_cat(fn, ".json"); | 102 | fn = xs_str_cat(fn, ".json"); |
| 103 | 103 | ||
| 104 | if ((f = fopen(fn, "w")) != NULL) { | 104 | if ((f = fopen(fn, "w")) != NULL) { |
| 105 | xs_json_dump_pp(token, 4, f); | 105 | xs_json_dump(token, 4, f); |
| 106 | fclose(f); | 106 | fclose(f); |
| 107 | } | 107 | } |
| 108 | else | 108 | else |
| @@ -358,7 +358,7 @@ int oauth_post_handler(const xs_dict *req, const char *q_path, | |||
| 358 | if (!xs_is_null(scope)) | 358 | if (!xs_is_null(scope)) |
| 359 | rsp = xs_dict_append(rsp, "scope", scope); | 359 | rsp = xs_dict_append(rsp, "scope", scope); |
| 360 | 360 | ||
| 361 | *body = xs_json_dumps_pp(rsp, 4); | 361 | *body = xs_json_dumps(rsp, 4); |
| 362 | *ctype = "application/json"; | 362 | *ctype = "application/json"; |
| 363 | status = 200; | 363 | status = 200; |
| 364 | 364 | ||
| @@ -962,7 +962,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 962 | 962 | ||
| 963 | acct = xs_dict_append(acct, "avatar", avatar); | 963 | acct = xs_dict_append(acct, "avatar", avatar); |
| 964 | 964 | ||
| 965 | *body = xs_json_dumps_pp(acct, 4); | 965 | *body = xs_json_dumps(acct, 4); |
| 966 | *ctype = "application/json"; | 966 | *ctype = "application/json"; |
| 967 | status = 200; | 967 | status = 200; |
| 968 | } | 968 | } |
| @@ -989,7 +989,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 989 | res = xs_list_append(res, rel); | 989 | res = xs_list_append(res, rel); |
| 990 | } | 990 | } |
| 991 | 991 | ||
| 992 | *body = xs_json_dumps_pp(res, 4); | 992 | *body = xs_json_dumps(res, 4); |
| 993 | *ctype = "application/json"; | 993 | *ctype = "application/json"; |
| 994 | status = 200; | 994 | status = 200; |
| 995 | } | 995 | } |
| @@ -1132,7 +1132,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1132 | } | 1132 | } |
| 1133 | 1133 | ||
| 1134 | if (out != NULL) { | 1134 | if (out != NULL) { |
| 1135 | *body = xs_json_dumps_pp(out, 4); | 1135 | *body = xs_json_dumps(out, 4); |
| 1136 | *ctype = "application/json"; | 1136 | *ctype = "application/json"; |
| 1137 | status = 200; | 1137 | status = 200; |
| 1138 | } | 1138 | } |
| @@ -1222,7 +1222,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1222 | cnt++; | 1222 | cnt++; |
| 1223 | } | 1223 | } |
| 1224 | 1224 | ||
| 1225 | *body = xs_json_dumps_pp(out, 4); | 1225 | *body = xs_json_dumps(out, 4); |
| 1226 | *ctype = "application/json"; | 1226 | *ctype = "application/json"; |
| 1227 | status = 200; | 1227 | status = 200; |
| 1228 | 1228 | ||
| @@ -1277,7 +1277,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1277 | } | 1277 | } |
| 1278 | } | 1278 | } |
| 1279 | 1279 | ||
| 1280 | *body = xs_json_dumps_pp(out, 4); | 1280 | *body = xs_json_dumps(out, 4); |
| 1281 | *ctype = "application/json"; | 1281 | *ctype = "application/json"; |
| 1282 | status = 200; | 1282 | status = 200; |
| 1283 | } | 1283 | } |
| @@ -1360,7 +1360,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1360 | out = xs_list_append(out, mn); | 1360 | out = xs_list_append(out, mn); |
| 1361 | } | 1361 | } |
| 1362 | 1362 | ||
| 1363 | *body = xs_json_dumps_pp(out, 4); | 1363 | *body = xs_json_dumps(out, 4); |
| 1364 | *ctype = "application/json"; | 1364 | *ctype = "application/json"; |
| 1365 | status = 200; | 1365 | status = 200; |
| 1366 | } | 1366 | } |
| @@ -1498,7 +1498,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1498 | } | 1498 | } |
| 1499 | } | 1499 | } |
| 1500 | 1500 | ||
| 1501 | *body = xs_json_dumps_pp(ins, 4); | 1501 | *body = xs_json_dumps(ins, 4); |
| 1502 | *ctype = "application/json"; | 1502 | *ctype = "application/json"; |
| 1503 | status = 200; | 1503 | status = 200; |
| 1504 | } | 1504 | } |
| @@ -1597,7 +1597,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1597 | srv_debug(1, xs_fmt("mastoapi status: bad id %s", id)); | 1597 | srv_debug(1, xs_fmt("mastoapi status: bad id %s", id)); |
| 1598 | 1598 | ||
| 1599 | if (out != NULL) { | 1599 | if (out != NULL) { |
| 1600 | *body = xs_json_dumps_pp(out, 4); | 1600 | *body = xs_json_dumps(out, 4); |
| 1601 | *ctype = "application/json"; | 1601 | *ctype = "application/json"; |
| 1602 | status = 200; | 1602 | status = 200; |
| 1603 | } | 1603 | } |
| @@ -1661,7 +1661,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, | |||
| 1661 | res = xs_dict_append(res, "statuses", stl); | 1661 | res = xs_dict_append(res, "statuses", stl); |
| 1662 | res = xs_dict_append(res, "hashtags", htl); | 1662 | res = xs_dict_append(res, "hashtags", htl); |
| 1663 | 1663 | ||
| 1664 | *body = xs_json_dumps_pp(res, 4); | 1664 | *body = xs_json_dumps(res, 4); |
| 1665 | *ctype = "application/json"; | 1665 | *ctype = "application/json"; |
| 1666 | status = 200; | 1666 | status = 200; |
| 1667 | } | 1667 | } |
| @@ -1739,7 +1739,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1739 | app = xs_dict_append(app, "vapid_key", vkey); | 1739 | app = xs_dict_append(app, "vapid_key", vkey); |
| 1740 | app = xs_dict_append(app, "id", id); | 1740 | app = xs_dict_append(app, "id", id); |
| 1741 | 1741 | ||
| 1742 | *body = xs_json_dumps_pp(app, 4); | 1742 | *body = xs_json_dumps(app, 4); |
| 1743 | *ctype = "application/json"; | 1743 | *ctype = "application/json"; |
| 1744 | status = 200; | 1744 | status = 200; |
| 1745 | 1745 | ||
| @@ -1828,7 +1828,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1828 | /* convert to a mastodon status as a response code */ | 1828 | /* convert to a mastodon status as a response code */ |
| 1829 | xs *st = mastoapi_status(&snac, msg); | 1829 | xs *st = mastoapi_status(&snac, msg); |
| 1830 | 1830 | ||
| 1831 | *body = xs_json_dumps_pp(st, 4); | 1831 | *body = xs_json_dumps(st, 4); |
| 1832 | *ctype = "application/json"; | 1832 | *ctype = "application/json"; |
| 1833 | status = 200; | 1833 | status = 200; |
| 1834 | } | 1834 | } |
| @@ -1924,7 +1924,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1924 | } | 1924 | } |
| 1925 | 1925 | ||
| 1926 | if (out != NULL) { | 1926 | if (out != NULL) { |
| 1927 | *body = xs_json_dumps_pp(out, 4); | 1927 | *body = xs_json_dumps(out, 4); |
| 1928 | *ctype = "application/json"; | 1928 | *ctype = "application/json"; |
| 1929 | status = 200; | 1929 | status = 200; |
| 1930 | } | 1930 | } |
| @@ -1967,7 +1967,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 1967 | xs *server_key = random_str(); | 1967 | xs *server_key = random_str(); |
| 1968 | wpush = xs_dict_append(wpush, "server_key", server_key); | 1968 | wpush = xs_dict_append(wpush, "server_key", server_key); |
| 1969 | 1969 | ||
| 1970 | *body = xs_json_dumps_pp(wpush, 4); | 1970 | *body = xs_json_dumps(wpush, 4); |
| 1971 | *ctype = "application/json"; | 1971 | *ctype = "application/json"; |
| 1972 | status = 200; | 1972 | status = 200; |
| 1973 | } | 1973 | } |
| @@ -2010,7 +2010,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 2010 | rsp = xs_dict_append(rsp, "remote_url", url); | 2010 | rsp = xs_dict_append(rsp, "remote_url", url); |
| 2011 | rsp = xs_dict_append(rsp, "description", desc); | 2011 | rsp = xs_dict_append(rsp, "description", desc); |
| 2012 | 2012 | ||
| 2013 | *body = xs_json_dumps_pp(rsp, 4); | 2013 | *body = xs_json_dumps(rsp, 4); |
| 2014 | *ctype = "application/json"; | 2014 | *ctype = "application/json"; |
| 2015 | status = 200; | 2015 | status = 200; |
| 2016 | } | 2016 | } |
| @@ -2095,7 +2095,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 2095 | } | 2095 | } |
| 2096 | 2096 | ||
| 2097 | if (rsp != NULL) { | 2097 | if (rsp != NULL) { |
| 2098 | *body = xs_json_dumps_pp(rsp, 4); | 2098 | *body = xs_json_dumps(rsp, 4); |
| 2099 | *ctype = "application/json"; | 2099 | *ctype = "application/json"; |
| 2100 | status = 200; | 2100 | status = 200; |
| 2101 | } | 2101 | } |
| @@ -2157,7 +2157,7 @@ int mastoapi_post_handler(const xs_dict *req, const char *q_path, | |||
| 2157 | } | 2157 | } |
| 2158 | 2158 | ||
| 2159 | if (out != NULL) { | 2159 | if (out != NULL) { |
| 2160 | *body = xs_json_dumps_pp(out, 4); | 2160 | *body = xs_json_dumps(out, 4); |
| 2161 | *ctype = "application/json"; | 2161 | *ctype = "application/json"; |
| 2162 | status = 200; | 2162 | status = 200; |
| 2163 | } | 2163 | } |
| @@ -2226,7 +2226,7 @@ int mastoapi_put_handler(const xs_dict *req, const char *q_path, | |||
| 2226 | rsp = xs_dict_append(rsp, "remote_url", url); | 2226 | rsp = xs_dict_append(rsp, "remote_url", url); |
| 2227 | rsp = xs_dict_append(rsp, "description", desc); | 2227 | rsp = xs_dict_append(rsp, "description", desc); |
| 2228 | 2228 | ||
| 2229 | *body = xs_json_dumps_pp(rsp, 4); | 2229 | *body = xs_json_dumps(rsp, 4); |
| 2230 | *ctype = "application/json"; | 2230 | *ctype = "application/json"; |
| 2231 | status = 200; | 2231 | status = 200; |
| 2232 | } | 2232 | } |
| @@ -312,7 +312,7 @@ int snac_upgrade(xs_str **error) | |||
| 312 | FILE *f; | 312 | FILE *f; |
| 313 | 313 | ||
| 314 | if ((f = fopen(fn, "w")) != NULL) { | 314 | if ((f = fopen(fn, "w")) != NULL) { |
| 315 | xs_json_dump_pp(srv_config, 4, f); | 315 | xs_json_dump(srv_config, 4, f); |
| 316 | fclose(f); | 316 | fclose(f); |
| 317 | 317 | ||
| 318 | srv_log(xs_fmt("disk layout upgraded %s after %d changes", fn, changed)); | 318 | srv_log(xs_fmt("disk layout upgraded %s after %d changes", fn, changed)); |
| @@ -194,7 +194,7 @@ int snac_init(const char *basedir) | |||
| 194 | return 1; | 194 | return 1; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | xs_json_dump_pp(srv_config, 4, f); | 197 | xs_json_dump(srv_config, 4, f); |
| 198 | fclose(f); | 198 | fclose(f); |
| 199 | 199 | ||
| 200 | printf("Done.\n"); | 200 | printf("Done.\n"); |
| @@ -275,7 +275,7 @@ int adduser(const char *uid) | |||
| 275 | return 1; | 275 | return 1; |
| 276 | } | 276 | } |
| 277 | else { | 277 | else { |
| 278 | xs_json_dump_pp(config, 4, f); | 278 | xs_json_dump(config, 4, f); |
| 279 | fclose(f); | 279 | fclose(f); |
| 280 | } | 280 | } |
| 281 | 281 | ||
| @@ -290,7 +290,7 @@ int adduser(const char *uid) | |||
| 290 | return 1; | 290 | return 1; |
| 291 | } | 291 | } |
| 292 | else { | 292 | else { |
| 293 | xs_json_dump_pp(key, 4, f); | 293 | xs_json_dump(key, 4, f); |
| 294 | fclose(f); | 294 | fclose(f); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| @@ -316,7 +316,7 @@ int resetpwd(snac *snac) | |||
| 316 | snac->config = xs_dict_set(snac->config, "passwd", hashed_pwd); | 316 | snac->config = xs_dict_set(snac->config, "passwd", hashed_pwd); |
| 317 | 317 | ||
| 318 | if ((f = fopen(fn, "w")) != NULL) { | 318 | if ((f = fopen(fn, "w")) != NULL) { |
| 319 | xs_json_dump_pp(snac->config, 4, f); | 319 | xs_json_dump(snac->config, 4, f); |
| 320 | fclose(f); | 320 | fclose(f); |
| 321 | 321 | ||
| 322 | printf("New password for user %s is %s\n", snac->uid, clear_pwd); | 322 | printf("New password for user %s is %s\n", snac->uid, clear_pwd); |
diff --git a/webfinger.c b/webfinger.c index 9c1ac49..1b11ab5 100644 --- a/webfinger.c +++ b/webfinger.c | |||
| @@ -184,7 +184,7 @@ int webfinger_get_handler(d_char *req, char *q_path, | |||
| 184 | obj = xs_dict_append(obj, "subject", acct); | 184 | obj = xs_dict_append(obj, "subject", acct); |
| 185 | obj = xs_dict_append(obj, "links", links); | 185 | obj = xs_dict_append(obj, "links", links); |
| 186 | 186 | ||
| 187 | j = xs_json_dumps_pp(obj, 4); | 187 | j = xs_json_dumps(obj, 4); |
| 188 | 188 | ||
| 189 | user_free(&snac); | 189 | user_free(&snac); |
| 190 | 190 | ||
| @@ -4,8 +4,8 @@ | |||
| 4 | 4 | ||
| 5 | #define _XS_JSON_H | 5 | #define _XS_JSON_H |
| 6 | 6 | ||
| 7 | int xs_json_dump_pp(const xs_val *data, int indent, FILE *f); | 7 | int xs_json_dump(const xs_val *data, int indent, FILE *f); |
| 8 | xs_str *xs_json_dumps_pp(const xs_val *data, int indent); | 8 | xs_str *xs_json_dumps(const xs_val *data, int indent); |
| 9 | xs_val *xs_json_loads(const xs_str *json); | 9 | xs_val *xs_json_loads(const xs_str *json); |
| 10 | xs_val *xs_json_load(FILE *f); | 10 | xs_val *xs_json_load(FILE *f); |
| 11 | 11 | ||
| @@ -141,7 +141,7 @@ static void _xs_json_dump(const xs_val *s_data, int level, int indent, FILE *f) | |||
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | 143 | ||
| 144 | xs_str *xs_json_dumps_pp(const xs_val *data, int indent) | 144 | xs_str *xs_json_dumps(const xs_val *data, int indent) |
| 145 | /* dumps data as a JSON string */ | 145 | /* dumps data as a JSON string */ |
| 146 | { | 146 | { |
| 147 | xs_str *s = NULL; | 147 | xs_str *s = NULL; |
| @@ -149,7 +149,7 @@ xs_str *xs_json_dumps_pp(const xs_val *data, int indent) | |||
| 149 | FILE *f; | 149 | FILE *f; |
| 150 | 150 | ||
| 151 | if ((f = open_memstream(&s, &sz)) != NULL) { | 151 | if ((f = open_memstream(&s, &sz)) != NULL) { |
| 152 | int r = xs_json_dump_pp(data, indent, f); | 152 | int r = xs_json_dump(data, indent, f); |
| 153 | fclose(f); | 153 | fclose(f); |
| 154 | 154 | ||
| 155 | if (!r) | 155 | if (!r) |
| @@ -160,7 +160,7 @@ xs_str *xs_json_dumps_pp(const xs_val *data, int indent) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | 162 | ||
| 163 | int xs_json_dump_pp(const xs_val *data, int indent, FILE *f) | 163 | int xs_json_dump(const xs_val *data, int indent, FILE *f) |
| 164 | /* dumps data into a file as JSON */ | 164 | /* dumps data into a file as JSON */ |
| 165 | { | 165 | { |
| 166 | xstype t = xs_type(data); | 166 | xstype t = xs_type(data); |
diff --git a/xs_version.h b/xs_version.h index 6493edb..5131181 100644 --- a/xs_version.h +++ b/xs_version.h | |||
| @@ -1 +1 @@ | |||
| /* 568c95296bb7d5b40e35e49220403358bc7dadfc */ | /* 4d883b5331e9275f2439b0983a0f978d1cd21e11 */ | ||