summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-12 10:45:28 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-12 10:45:28 +0800
commitbf2f5bae48a3f7daee7f2096328dada68eacd3fd (patch)
treec4394509cf9a194b9241d67fd9b773b3383d18c2
parent73a484ced42c0370ea8569dc25be433904ca8647 (diff)
Add ptr to a rtclient parameter
to be more correct, like in getline.
-rw-r--r--rtclient.c12
-rw-r--r--rtclient.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/rtclient.c b/rtclient.c
index 04332c7..400cc66 100644
--- a/rtclient.c
+++ b/rtclient.c
@@ -82,8 +82,8 @@ user_callback(void *contents, size_t size, size_t nmemb, void *writedata)
lines[i++] = line;
line = strtok(NULL, "\n");
}
- rt_user **userp = (rt_user **)writedata;
- rt_user *user = *userp;
+ rt_user **userptr = (rt_user **)writedata;
+ rt_user *user = *userptr;
for (unsigned short i = 0; i < nproperties; i++) {
char *token = strtok(lines[i], ":");
if (!strcmp(token, "id")) {
@@ -195,13 +195,13 @@ static inline void request(const char *path, const char *suffix)
curl_easy_perform(curl);
}
-bool rtclient_get_user(rt_user **user, const char *name)
+bool rtclient_get_user(rt_user **userptr, const char *name)
{
- *user = malloc(sizeof(rt_user));
- curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)user);
+ *userptr = malloc(sizeof(rt_user));
+ curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)userptr);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, user_callback);
request("/REST/1.0/user/", name);
- return (bool)(*user);
+ return (bool)(*userptr);
}
void rtclient_search(const char *query)
diff --git a/rtclient.h b/rtclient.h
index 32028b1..1fbf589 100644
--- a/rtclient.h
+++ b/rtclient.h
@@ -9,7 +9,7 @@ extern "C" {
bool rtclient_init(const char *server_url);
void rtclient_login(const char *name, const char *password);
- bool rtclient_get_user(struct rt_user **user, const char *name);
+ bool rtclient_get_user(struct rt_user **userptr, const char *name);
void rtclient_search(const char *query);
void rtclient_user_free(struct rt_user *user);
void rtclient_cleanup();