Skip to content
Snippets Groups Projects
Commit 076f2d9d authored by Jakob Olsson's avatar Jakob Olsson
Browse files

libmobile_zte: change apn_profile_len to function based on new array-based profile list

parent 2dcef1ba
No related branches found
No related tags found
No related merge requests found
...@@ -70,26 +70,25 @@ static int apn_profile_idx(struct json_object *container, char *name) ...@@ -70,26 +70,25 @@ static int apn_profile_idx(struct json_object *container, char *name)
*/ */
static int get_apn_profiles_len(char *ip_addr) static int get_apn_profiles_len(char *ip_addr)
{ {
struct json_object *apn_profiles = mobile_get_apn_profiles_zte(ip_addr); struct json_object *container, *profiles;
int len = 0; int len = 0;
if (!apn_profiles) { container = mobile_get_apn_profiles_zte(ip_addr);
if (!container) {
//debug_print("Failed to get apn profiles from server!\n"); //debug_print("Failed to get apn profiles from server!\n");
goto fail; goto fail;
} }
json_object_object_foreach(apn_profiles, key, val) { json_object_object_get_ex(container, "profiles", &profiles);
int val_type = json_object_get_type(val); if (!profiles)
goto fail_profiles;
if (val_type != json_type_string) len = json_object_array_length(profiles);
len++;
else
goto success;
}
success: json_object_put(container);
json_object_put(apn_profiles);
return len; return len;
fail_profiles:
json_object_put(container);
fail: fail:
return -1; return -1;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment