diff options
author | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-18 07:40:18 +0800 |
---|---|---|
committer | ꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id> | 2019-09-18 07:40:18 +0800 |
commit | c9a800017c40ef620f3bbbcc3dc49b831429dfd6 (patch) | |
tree | 321007eed2a5f0d91ffbe57ed706f6f820997821 | |
parent | a47c5c334245e2c93edd37be156d9560843deca6 (diff) |
Initialise user earlier
-rw-r--r-- | user.c | 51 |
1 files changed, 26 insertions, 25 deletions
@@ -14,31 +14,6 @@ static size_t show_callback(void *contents, size_t size, size_t nmemb rtclient_user **userptr = (rtclient_user **)writedata; rtclient_user *user = *userptr; - user->id = NULL; - user->name = NULL; - user->password = NULL; - user->emailaddress = NULL; - user->realname = NULL; - user->nickname = NULL; - user->organization = NULL; - user->address1 = NULL; - user->address2 = NULL; - user->city = NULL; - user->state = NULL; - user->zip = NULL; - user->country = NULL; - user->homephone = NULL; - user->workphone = NULL; - user->mobilephone = NULL; - user->pagerphone = NULL; - user->contactinfo = NULL; - user->comments = NULL; - user->signature = NULL; - user->gecos = NULL; - user->lang = RTCLIENT_LANG_NONE; - user->timezone = RTCLIENT_TIMEZONE_NONE; - user->privileged = false; - user->disabled = true; char *linesaveptr = NULL; char *line = strtok_r(response, "\n", &linesaveptr); @@ -153,6 +128,32 @@ static size_t show_callback(void *contents, size_t size, size_t nmemb void rtclient_user_show(rtclient_user **userptr, const char *name) { *userptr = malloc(sizeof(rtclient_user)); + rtclient_user *user = *userptr; + user->id = NULL; + user->name = NULL; + user->password = NULL; + user->emailaddress = NULL; + user->realname = NULL; + user->nickname = NULL; + user->organization = NULL; + user->address1 = NULL; + user->address2 = NULL; + user->city = NULL; + user->state = NULL; + user->zip = NULL; + user->country = NULL; + user->homephone = NULL; + user->workphone = NULL; + user->mobilephone = NULL; + user->pagerphone = NULL; + user->contactinfo = NULL; + user->comments = NULL; + user->signature = NULL; + user->gecos = NULL; + user->lang = RTCLIENT_LANG_NONE; + user->timezone = RTCLIENT_TIMEZONE_NONE; + user->privileged = false; + user->disabled = true; request("/REST/1.0/user/", name, show_callback, (void *)userptr, NULL); } |