diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-07-20 17:27:36 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-07-21 00:28:18 +0000 |
commit | 3beab65515ab693806a7b64665bfd287133e860e (patch) | |
tree | 8c6aa291589c54f2f2f96a7dca4bcb5c4518fcdd /ui/gtk | |
parent | be1398c17ca1d5b203a930d9254125d602830aef (diff) |
No need to check for string option values being null.
A string option, if present, always has a value; it might be a null
*string*, but you won't get a null pointer (if the option isn't present,
it simply isn't present).
Fix some comments while we're at it.
Change-Id: I9c1420f56998a7d04de5c5cc2e92631b181f303a
Reviewed-on: https://code.wireshark.org/review/16564
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/summary_dlg.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/ui/gtk/summary_dlg.c b/ui/gtk/summary_dlg.c index 78f596c49e..41946ca9ea 100644 --- a/ui/gtk/summary_dlg.c +++ b/ui/gtk/summary_dlg.c @@ -296,7 +296,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) /* XXX - this only shows the last comment */ for (i = 0; wtap_block_get_nth_string_option_value(shb_inf, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) { - if (opt_comment != NULL && opt_comment[0] != '\0') + if (opt_comment[0] != '\0') gtk_text_buffer_set_text (buffer, opt_comment, -1); } } @@ -349,20 +349,20 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_) char *str; if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL && str[0] != '\0') { + str[0] != '\0') { g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str); add_string_to_grid(grid, &row, "Capture HW:",string_buff); } if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL && str[0] != '\0') { + str[0] != '\0') { /* truncate the strings to a reasonable length */ g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str); add_string_to_grid(grid, &row, "OS:", string_buff); } if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL && str[0] != '\0') { + str[0] != '\0') { /* truncate the strings to a reasonable length */ g_snprintf(string_buff, SHB_STR_SNIP_LEN, "%s", str); add_string_to_grid(grid, &row, "Capture application:", string_buff); @@ -766,19 +766,19 @@ summary_to_texbuff(GtkTextBuffer *buffer) char *str; if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL && str[0] != '\0') { + str[0] != '\0') { /* truncate the string to a reasonable length */ g_snprintf(string_buff, SUM_STR_MAX, INDENT "Capture HW: %s\n", str); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); } if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL && str[0] != '\0') { + str[0] != '\0') { /* truncate the strings to a reasonable length */ g_snprintf(string_buff, SUM_STR_MAX, INDENT "OS: %s\n", str); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); } if (wtap_block_get_string_option_value(shb_inf, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL && str[0] != '\0') { + str[0] != '\0') { /* truncate the string to a reasonable length */ g_snprintf(string_buff, SUM_STR_MAX, INDENT "Capture application: %s\n", str); gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1); @@ -902,7 +902,7 @@ summary_to_texbuff(GtkTextBuffer *buffer) for (i = 0; wtap_block_get_nth_string_option_value(shb_inf, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) { /* XXX - separator between comments? */ - if (opt_comment != NULL && opt_comment[0] != '\0') + if (opt_comment[0] != '\0') gtk_text_buffer_insert_at_cursor(buffer, opt_comment, -1); } } |