diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-11-22 02:09:46 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-11-22 02:09:46 +0000 |
commit | 7a688c56fbd72b9683c12fc7ecf0bfe1c132394f (patch) | |
tree | fe00b8f24d9ca51a83ad8d4a7f4753383893506d /capture_ui_utils.c | |
parent | 69a454c744116af03cd2cd62376ce70b2d7359f9 (diff) |
Clean up indentation.
svn path=/trunk/; revision=46127
Diffstat (limited to 'capture_ui_utils.c')
-rw-r--r-- | capture_ui_utils.c | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/capture_ui_utils.c b/capture_ui_utils.c index d8aa25c617..7af80a9a72 100644 --- a/capture_ui_utils.c +++ b/capture_ui_utils.c @@ -47,89 +47,89 @@ char * capture_dev_user_descr_find(const gchar *if_name) { - char *p; - char *p2 = NULL; - char *descr = NULL; - int lp = 0; - int ct = 0; - - if ((prefs.capture_devices_descr == NULL) || - (*prefs.capture_devices_descr == '\0')) { - /* There are no descriptions. */ - return NULL; - } - - if ((p = strstr(prefs.capture_devices_descr, if_name)) == NULL) { - /* There are, but there isn't one for this interface. */ - return NULL; - } - - while (*p != '\0') { - /* error: ran into next interface description */ - if (*p == ',') - return NULL; - /* found left parenthesis, start of description */ - else if (*p == '(') { - ct = 0; - lp++; - /* skip over left parenthesis */ - p++; - /* save pointer to beginning of description */ - p2 = p; - continue; - } - else if (*p == ')') { - /* end of description */ - break; - } - else { - p++; - ct++; - } - } - - if ((lp == 1) && (ct > 0) && (p2 != NULL)) { - /* Allocate enough space to return the string, - which runs from p2 to p, plus a terminating - '\0'. */ - descr = g_malloc(p - p2 + 1); - memcpy(descr, p2, p - p2); - descr[p - p2] = '\0'; - return descr; - } - else - return NULL; + char *p; + char *p2 = NULL; + char *descr = NULL; + int lp = 0; + int ct = 0; + + if ((prefs.capture_devices_descr == NULL) || + (*prefs.capture_devices_descr == '\0')) { + /* There are no descriptions. */ + return NULL; + } + + if ((p = strstr(prefs.capture_devices_descr, if_name)) == NULL) { + /* There are, but there isn't one for this interface. */ + return NULL; + } + + while (*p != '\0') { + /* error: ran into next interface description */ + if (*p == ',') + return NULL; + /* found left parenthesis, start of description */ + else if (*p == '(') { + ct = 0; + lp++; + /* skip over left parenthesis */ + p++; + /* save pointer to beginning of description */ + p2 = p; + continue; + } + else if (*p == ')') { + /* end of description */ + break; + } + else { + p++; + ct++; + } + } + + if ((lp == 1) && (ct > 0) && (p2 != NULL)) { + /* Allocate enough space to return the string, + which runs from p2 to p, plus a terminating + '\0'. */ + descr = g_malloc(p - p2 + 1); + memcpy(descr, p2, p - p2); + descr[p - p2] = '\0'; + return descr; + } + else + return NULL; } gint capture_dev_user_linktype_find(const gchar *if_name) { - gchar *p, *next; - long linktype; - - if ((prefs.capture_devices_linktypes == NULL) || - (*prefs.capture_devices_linktypes == '\0')) { - /* There are no link-layer header types */ - return -1; - } - - if ((p = strstr(prefs.capture_devices_linktypes, if_name)) == NULL) { - /* There are, but there isn't one for this interface. */ - return -1; - } - - p += strlen(if_name) + 1; - linktype = strtol(p, &next, 10); - if (next == p || *next != ')' || linktype < 0) { - /* Syntax error */ - return -1; - } - if (linktype > G_MAXINT) { - /* Value doesn't fit in a gint */ - return -1; - } - - return (gint)linktype; + gchar *p, *next; + long linktype; + + if ((prefs.capture_devices_linktypes == NULL) || + (*prefs.capture_devices_linktypes == '\0')) { + /* There are no link-layer header types */ + return -1; + } + + if ((p = strstr(prefs.capture_devices_linktypes, if_name)) == NULL) { + /* There are, but there isn't one for this interface. */ + return -1; + } + + p += strlen(if_name) + 1; + linktype = strtol(p, &next, 10); + if (next == p || *next != ')' || linktype < 0) { + /* Syntax error */ + return -1; + } + if (linktype > G_MAXINT) { + /* Value doesn't fit in a gint */ + return -1; + } + + return (gint)linktype; } /* @@ -270,7 +270,7 @@ build_capture_combo_list(GList *if_list, gboolean do_hide) if (if_list != NULL) { /* Scan through the list and build a list of strings to display. */ for (if_entry = if_list; if_entry != NULL; - if_entry = g_list_next(if_entry)) { + if_entry = g_list_next(if_entry)) { if_info = if_entry->data; /* Is this interface hidden and, if so, should we include it @@ -281,16 +281,16 @@ build_capture_combo_list(GList *if_list, gboolean do_hide) /* Do we have a user-supplied description? */ descr = capture_dev_user_descr_find(if_info->name); if (descr != NULL) { - /* Yes, we have a user-supplied description; use it. */ - if_string = g_strdup_printf("%s: %s", descr, if_info->name); + /* Yes, we have a user-supplied description; use it. */ + if_string = g_strdup_printf("%s: %s", descr, if_info->name); g_free(descr); } else { /* No, we don't have a user-supplied description; did we get - one from the OS or libpcap? */ + one from the OS or libpcap? */ if (if_info->description != NULL) { /* Yes - use it. */ - if_string = g_strdup_printf("%s: %s", if_info->description, - if_info->name); + if_string = g_strdup_printf("%s: %s", if_info->description, + if_info->name); } else { /* No. */ if_string = g_strdup(if_info->name); |