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

small improvement to code size

parent 44e33d8a
Branches
Tags
No related merge requests found
......@@ -31,12 +31,8 @@ int list_apn_profiles(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char *response = mobile_get_apn_profiles();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int delete_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -50,12 +46,8 @@ int delete_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
strncpy(name, (char *)blobmsg_data(tb[APN]), 1023);
char *response = mobile_delete_apn(name);
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int set_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -69,12 +61,8 @@ int set_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
strncpy(name, (char *)blobmsg_data(tb[APN]), 1023);
char *response = mobile_set_apn_profile(name);
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int create_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -88,12 +76,8 @@ int create_apn_profile(struct ubus_context *ctx, struct ubus_object *obj,
strncpy(name, (char *)blobmsg_data(tb[APN]), 1023);
char *response = mobile_create_apn_profile(name);
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int show_current_apn(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -102,12 +86,8 @@ int show_current_apn(struct ubus_context *ctx, struct ubus_object *obj,
{
//char *wan_apn = mobile_get_request("wan_apn");
char *response = mobile_get_wan_apn();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
struct ubus_method dongle_object_methods[] = {
......
......@@ -23,24 +23,16 @@ int get_signal_strength(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char *response = mobile_get_rssi();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int connect_network(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
char *response = mobile_connect_network();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int disconnect(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -48,12 +40,8 @@ int disconnect(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char *response = mobile_disconnect_network();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int modem_state(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -61,12 +49,8 @@ int modem_state(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char *response = mobile_get_modem_state();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int enable_roaming(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -74,12 +58,8 @@ int enable_roaming(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char *response = mobile_enable_roaming();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int disable_roaming(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -87,12 +67,8 @@ int disable_roaming(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char response = *mobile_disable_roaming();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
int roam_status(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -100,12 +76,8 @@ int roam_status(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
char *response = mobile_get_roam_status();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
struct ubus_method dongle_object_methods[] = {
......
......@@ -313,11 +313,9 @@ int verify_pin(struct ubus_context *ctx, struct ubus_object *obj,
}
char *response = mobile_set_pin(pin, pin);
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return parse_and_print(response, ctx, req);
fail:
return 0;
return -1;
}
int remaining_tries(struct ubus_context *ctx, struct ubus_object *obj,
......@@ -327,10 +325,7 @@ int remaining_tries(struct ubus_context *ctx, struct ubus_object *obj,
char *response = mobile_get_pinnumber();
int rv;
rv = parse_and_print(response, ctx, req);
if (rv < 0)
return -1;
return 0;
return parse_and_print(response, ctx, req);
}
struct ubus_method dongle_object_methods[] = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment