#ifndef MATRIX_CURL_UTIL_H #define MATRIX_CURL_UTIL_H #include #include #include CURLcode _curl_get(CURL *curl, const char *url, json_object **resp); CURLcode _curl_post(CURL *curl, const char *url, const char *postdata, json_object **resp); static inline int json_add_string(json_object *j, const char *k, const char *v) { return json_object_object_add(j, k, json_object_new_string(v)); } static inline char* copy_str(const char *s) { size_t l = strlen(s)+1; char *ss = (char*)malloc(l); memcpy(ss, s, l); return ss; } #endif