diff --git a/libmobile.c b/libmobile.c index 217593cbdc84f295f0c0eb1931235f940a778e9b..0484c46fcb40e41ff889d96e0599a668b010f1bf 100644 --- a/libmobile.c +++ b/libmobile.c @@ -45,7 +45,7 @@ static void curl_cleaner(CURLcode *curl) * userp - Pointer to area allocated for storing results from server. * * Returns: - * Number of bytes managed (size*nmemb). + * Number of bytes managed (size*nmemb). */ static size_t write_func(void *buffer, size_t size, size_t nmemb, void *userp) { @@ -80,6 +80,7 @@ static size_t write_func(void *buffer, size_t size, size_t nmemb, void *userp) static int apn_profile_idx(struct json_object *apn_profiles, char *name) { int idx = 0; + json_object_object_foreach(apn_profiles, key, val) { char *apn_profile = json_object_get_string(val); @@ -114,7 +115,7 @@ static int get_apn_profiles_len(void) } struct json_object *parsed_response = json_tokener_parse(response); - if(!parsed_response) { + if (!parsed_response) { printf("no valid json to parse!"); goto free_response; } @@ -145,7 +146,7 @@ success: * prior to the delimiter, and removes it from the input string. * * Parameters: - * input - A character pointer address to the pointer pointing at the string to split. + * input - A character pointer address to the pointer pointing at the string to split. * delimiter - A character pointer pointing to the delimiter on which to split the string on. * * Returns: @@ -157,11 +158,11 @@ success: * The caller is responsible for freeing the return value. */ static char *lexer(char **input, char *delimiter) { - if(strlen(*input) == 0) { + if (strlen(*input) == 0) { printf("empty input!\n"); return NULL; } - if(strlen(delimiter) == 0) { + if (strlen(delimiter) == 0) { printf("empty delimiter!\n"); return NULL; } @@ -192,8 +193,7 @@ static char *lexer(char **input, char *delimiter) { */ static char *get_query_wrapper(char *vars) { - if (strlen(vars) == 0) - { + if (strlen(vars) == 0) { printf("No GET input provided!\n"); return NULL; } @@ -279,7 +279,7 @@ char *mobile_delete_apn(char *name) } struct json_object *parsed_response = json_tokener_parse(response); - if(!parsed_response) { + if (!parsed_response) { printf("no valid json to parse!"); goto free_response; } @@ -376,7 +376,7 @@ char *mobile_set_apn_profile(char *name) } struct json_object *parsed_response = json_tokener_parse(response); - if(!parsed_response) { + if (!parsed_response) { printf("no valid json to parse!"); goto free_response; }