From 385364781fd3d60e225275467baa773db7a982bb Mon Sep 17 00:00:00 2001 From: "me@ow.nekobit.net" Date: Fri, 21 Jan 2022 04:16:00 +0000 Subject: [PATCH] Load json FossilOrigin-Name: ec9d16966d31ba7a95553a2a854cfc420d3aca600b0a60f48912f59b8c440e51 --- include/mastodont_fetch.h | 5 ++++- include/mastodont_types.h | 1 + src/.#timeline.c | 1 + src/timeline.c | 7 ++++++- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 120000 src/.#timeline.c diff --git a/include/mastodont_fetch.h b/include/mastodont_fetch.h index 9e33e22..fd91732 100644 --- a/include/mastodont_fetch.h +++ b/include/mastodont_fetch.h @@ -13,6 +13,8 @@ * along with this program. If not, see . */ +#ifndef MASTODONT_FETCH_H +#define MASTODONT_FETCH_H #include #include @@ -26,4 +28,5 @@ void mastodont_fetch_results_cleanup(struct mastodont_fetch_results* res); int mastodont_fetch_curl(mastodont_t* mstdnt, char* url, struct mastodont_fetch_results* results); -/*cJSON* mastodont_call_json();*/ + +#endif /* MASTODONT_FETCH_H */ diff --git a/include/mastodont_types.h b/include/mastodont_types.h index d5927a9..851c7a9 100644 --- a/include/mastodont_types.h +++ b/include/mastodont_types.h @@ -24,6 +24,7 @@ typedef struct mastodont { CURL* curl; } mastodont_t; +/* FIXME */ struct mstdnt_response { char* data; size_t size; diff --git a/src/.#timeline.c b/src/.#timeline.c new file mode 120000 index 0000000..3a5448d --- /dev/null +++ b/src/.#timeline.c @@ -0,0 +1 @@ +nekobit@toomuchram.2058:1642690987 \ No newline at end of file diff --git a/src/timeline.c b/src/timeline.c index 0d3070b..e924ed3 100644 --- a/src/timeline.c +++ b/src/timeline.c @@ -40,8 +40,13 @@ int mastodont_timeline_public(mastodont_t* data, res = mastodont_fetch_curl(data, "/api/v1/timelines/public", &results); - printf("Size of data: %zd\n", results.size); + cJSON* parse = cJSON_Parse(results.response); + + + /* Cleanup */ +free: + cJSON_Delete(parse); mastodont_fetch_results_cleanup(&results); return res;