diff options
author | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-02-17 04:35:12 +0000 |
---|---|---|
committer | guy <guy@f5534014-38df-0310-8fa8-9805f1628bb7> | 2011-02-17 04:35:12 +0000 |
commit | 34febe08f0047cc517f50a9082367e8848352aa8 (patch) | |
tree | 10602dd528bd340655e02730be893ee51907e138 /capture_ui_utils.c | |
parent | 534538e9cdd1c3fbb2a0aa004b09e0ac52fa1800 (diff) |
Use "XXX != NULL" rather than "XXX" to test for a null pointer; either
I'm missing something or the MSVC++ code analyzer doesn't realize that
in
if (XXX)
dereference XXX
will not dereference XXX if it's null - maybe "if (XXX != NULL)" will do
the trick (if so, the code analyzer is buggy, because "if (XXX !=
NULL)", "if (XXX != 0)", and "if (XXX)" mean the exact same thing if XXX
is a pointer-valued expression, really, truly, even if a null pointer
isn't represented as all zero bits or if it's wider than an int).
Clean up indentation.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@35973 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'capture_ui_utils.c')
-rw-r--r-- | capture_ui_utils.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/capture_ui_utils.c b/capture_ui_utils.c index c8f9be7dc8..ba011e23cf 100644 --- a/capture_ui_utils.c +++ b/capture_ui_utils.c @@ -203,19 +203,19 @@ get_interface_descriptive_name(const char *if_name) static if_info_t * search_info(GList *if_list, gchar *if_name) { - GList *if_entry; - if_info_t *if_info; + GList *if_entry; + if_info_t *if_info; - for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) { - if_info = if_entry->data; + for (if_entry = if_list; if_entry != NULL; if_entry = g_list_next(if_entry)) { + if_info = if_entry->data; - if(strcmp(if_name, if_info->name) == 0) { - return if_info; - } + if(strcmp(if_name, if_info->name) == 0) { + return if_info; } + } - return NULL; + return NULL; } @@ -223,32 +223,31 @@ search_info(GList *if_list, gchar *if_name) char * build_capture_combo_name(GList *if_list, gchar *if_name) { - gchar *descr; - char *if_string; - if_info_t *if_info; - - - /* Do we have a user-supplied description? */ - descr = capture_dev_user_descr_find(if_name); - if (descr != NULL) { - /* Yes, we have a user-supplied description; use it. */ - if_string = g_strdup_printf("%s: %s", descr, if_name); - g_free(descr); - } else { - /* No, we don't have a user-supplied description; did we get - one from the OS or libpcap? */ - if_info = search_info(if_list, if_name); - if (if_info && if_info->description != NULL) { - /* Yes - use it. */ - if_string = g_strdup_printf("%s: %s", if_info->description, - if_info->name); - } else { - /* No. */ - if_string = g_strdup(if_name); - } - } + gchar *descr; + char *if_string; + if_info_t *if_info; + + /* Do we have a user-supplied description? */ + descr = capture_dev_user_descr_find(if_name); + if (descr != NULL) { + /* Yes, we have a user-supplied description; use it. */ + if_string = g_strdup_printf("%s: %s", descr, if_name); + g_free(descr); + } else { + /* No, we don't have a user-supplied description; did we get + one from the OS or libpcap? */ + if_info = search_info(if_list, if_name); + if (if_info != NULL && if_info->description != NULL) { + /* Yes - use it. */ + if_string = g_strdup_printf("%s: %s", if_info->description, + if_info->name); + } else { + /* No. */ + if_string = g_strdup(if_name); + } + } - return if_string; + return if_string; } |