From 3beab65515ab693806a7b64665bfd287133e860e Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 20 Jul 2016 17:27:36 -0700 Subject: 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 --- capinfos.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'capinfos.c') diff --git a/capinfos.c b/capinfos.c index f4ea0bb63a..4b8debab94 100644 --- a/capinfos.c +++ b/capinfos.c @@ -993,34 +993,29 @@ print_stats_table(const gchar *filename, capture_info *cf_info) char *opt_comment; for (i = 0; wtap_block_get_nth_string_option_value(cf_info->shb, OPT_COMMENT, i, &opt_comment) == WTAP_OPTTYPE_SUCCESS; i++) { - if (opt_comment != NULL) { - putsep(); - putquote(); - printf("%s", opt_comment); - putquote(); - } + putsep(); + putquote(); + printf("%s", opt_comment); + putquote(); } } if (cap_file_more_info) { char *str; - if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL) { + if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_HARDWARE, &str) == WTAP_OPTTYPE_SUCCESS) { putsep(); putquote(); printf("%s", str); putquote(); } - if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL) { + if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_OS, &str) == WTAP_OPTTYPE_SUCCESS) { putsep(); putquote(); printf("%s", str); putquote(); } - if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS && - str != NULL) { + if (wtap_block_get_string_option_value(cf_info->shb, OPT_SHB_USERAPPL, &str) == WTAP_OPTTYPE_SUCCESS) { putsep(); putquote(); printf("%s", str); -- cgit v1.2.3