[network-manager-openvpn/th/import-cleanup-bgo760987: 4/7] properties: return-early from handle_num_seconds_item()
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-openvpn/th/import-cleanup-bgo760987: 4/7] properties: return-early from handle_num_seconds_item()
- Date: Fri, 22 Jan 2016 14:28:15 +0000 (UTC)
commit 6a7d334b151a28f8f9f867d4b36418df87cb528d
Author: Thomas Haller <thaller redhat com>
Date: Fri Jan 22 14:25:35 2016 +0100
properties: return-early from handle_num_seconds_item()
properties/import-export.c | 34 ++++++++++++++++------------------
1 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/properties/import-export.c b/properties/import-export.c
index 91a26af..cda9de2 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -452,28 +452,26 @@ handle_num_seconds_item (const char *line,
{
char **items = NULL;
int nitems;
+ int seconds;
- if (!strncmp (line, tag, strlen (tag))) {
- int seconds;
-
- items = get_args (line + strlen (tag), &nitems);
- if (nitems == 1) {
- seconds = parse_seconds (items[0], line);
- if (seconds >= 0) {
- char *tmp;
+ if (strncmp (line, tag, strlen (tag)))
+ return FALSE;
- tmp = g_strdup_printf ("%d", seconds);
- nm_setting_vpn_add_data_item (s_vpn, key, tmp);
- g_free (tmp);
- }
- } else
- g_warning ("%s: invalid number of arguments in option '%s', must be one integer",
__func__, line);
+ items = get_args (line + strlen (tag), &nitems);
+ if (nitems == 1) {
+ seconds = parse_seconds (items[0], line);
+ if (seconds >= 0) {
+ char *tmp;
- g_strfreev (items);
- return TRUE;
- }
+ tmp = g_strdup_printf ("%d", seconds);
+ nm_setting_vpn_add_data_item (s_vpn, key, tmp);
+ g_free (tmp);
+ }
+ } else
+ g_warning ("%s: invalid number of arguments in option '%s', must be one integer", __func__,
line);
- return FALSE;
+ g_strfreev (items);
+ return TRUE;
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]