diff --git a/libmobile.c b/libmobile.c index a2afc628012c84f264a46e43c052a23c1c636757..ed179bcb9ef54116d55a94fb9dd9e5a4a0fb13e6 100644 --- a/libmobile.c +++ b/libmobile.c @@ -61,7 +61,7 @@ static size_t write_func(void *buffer, size_t size, size_t nmemb, void *data) str->ptr = realloc(str->ptr, new_len + 1); if (!str->ptr) { - debug_print("not enough memory (realloc returned NULL)\n"); + //debug_print("not enough memory (realloc returned NULL)\n"); free(tmp_ptr); return 0; } @@ -124,7 +124,7 @@ static int get_apn_profiles_len(void) int len = 0; if (!apn_profiles) { - debug_print("Failed to get apn profiles from server!\n"); + //debug_print("Failed to get apn profiles from server!\n"); goto fail; } @@ -167,10 +167,10 @@ static char *lexer(char **input, char *delimiter) char *token, *substr; if (strlen(*input) == 0) { - debug_print("empty input!\n"); + //debug_print("empty input!\n"); return NULL; } else if (strlen(delimiter) == 0) { - debug_print("empty delimiter!\n"); + //debug_print("empty delimiter!\n"); return NULL; } @@ -203,11 +203,11 @@ static char *get_query_wrapper(char *vars) char query[1024] = {0}; if (strlen(vars) == 0) { - debug_print("No GET input provided!\n"); + //debug_print("No GET input provided!\n"); return NULL; } snprintf(query, 1023, "http://192.168.0.1/goform/goform_get_cmd_process?isTest=false&cmd=%s&multi_data=1", vars); - debug_print("query %s\n", query); + //debug_print("query %s\n", query); return strdup(query); } @@ -280,13 +280,13 @@ static struct json_object *prepare_request(char *query, int option) str.ptr = calloc(1, 1); if (!str.ptr) { - debug_print("Error allocating memory with calloc"); + //debug_print("Error allocating memory with calloc"); goto fail; } curl = curl_easy_init(); if (!curl) { - debug_print("Failed to prepare curl environment!\n"); + //debug_print("Failed to prepare curl environment!\n"); goto fail_curl; } @@ -299,16 +299,16 @@ static struct json_object *prepare_request(char *query, int option) goto fail_request; if (rv) { - debug_print("error performing curl, %s\n", curl_easy_strerror(rv)); + //debug_print("error performing curl, %s\n", curl_easy_strerror(rv)); goto fail; } if (!str.ptr) goto fail_ptr; - debug_print("%s\n", str.ptr); + //debug_print("%s\n", str.ptr); parsed_response = json_tokener_parse(str.ptr); if (!parsed_response) { - debug_print("No valid JSON, failed parsing!\n"); + //debug_print("No valid JSON, failed parsing!\n"); goto fail_json; } @@ -391,12 +391,12 @@ struct json_object *mobile_delete_apn(char *name) int idx; if (!apn_profiles) { - debug_print("no response!\n"); + //debug_print("no response!\n"); goto fail; } idx = apn_profile_idx(apn_profiles, name); if (idx < 0) { - debug_print("APN not found in list!\n"); + //debug_print("APN not found in list!\n"); goto fail_idx; } @@ -432,7 +432,7 @@ struct json_object *mobile_get_current_apn(void) idx_json = prepare_request("Current_index", GET); if (!idx_json) { - debug_print("couldn't find index\n"); + //debug_print("couldn't find index\n"); goto fail; } @@ -440,7 +440,7 @@ struct json_object *mobile_get_current_apn(void) idx = json_object_get_int(idx_json); if (idx < 0 || idx > 9) { - debug_print("Something is very wrong!\n"); + //debug_print("Something is very wrong!\n"); goto fail_idx; } apn_profiles = mobile_get_apn_profiles(); @@ -491,7 +491,7 @@ struct json_object *mobile_get_apn_profiles(void) struct json_object *apn_profiles = prepare_request("APN_config0,APN_config1,APN_config2,APN_config3,APN_config4,APN_config5,APN_config6,APN_config7,APN_config8,APN_config9,APN_config10,APN_config11,APN_config12,APN_config13,APN_config14,APN_config15,APN_config16,APN_config17,APN_config18,APN_config19", GET); if (!apn_profiles) { - debug_print("Error getting profiles!\n"); + //debug_print("Error getting profiles!\n"); goto fail; } return parse_apn_profiles(apn_profiles); @@ -515,13 +515,13 @@ struct json_object *mobile_set_apn_profile(char *name) char query[1024] = {0}; if (!apn_profiles) { - debug_print("no response!\n"); + //debug_print("no response!\n"); goto fail; } idx = apn_profile_idx(apn_profiles, name); if (idx < 0) { - debug_print("couldnt find idx, no such profile!\n"); + //debug_print("couldnt find idx, no such profile!\n"); goto free_idx; } snprintf(query, 1023, "isTest=false&goformId=APN_PROC_EX&apn_mode=manual&apn_action=set_default&set_default_flag=1&pdp_type=IP&index=%d", idx);