From: Michal Privoznik Date: Fri, 10 Oct 2025 17:16:54 +0000 (+0200) Subject: wireshark: Don't special case retval of get_program_data() in dissect_libvirt_message() X-Git-Tag: v11.9.0-rc1~74 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1086888f95a322101f8cf53b63c96600ccbeb882;p=thirdparty%2Flibvirt.git wireshark: Don't special case retval of get_program_data() in dissect_libvirt_message() The get_program_data() function returns a pointer (in this specific case to an array of procedure strings) which, if non-NULL is then passed val_to_str(). Well, if val_to_str() sees NULL it is treated gracefully, i.e. like if the numeric value 'proc' wasn't found in the array. Therefore, there's no need to special case call to col_append_fstr(). Both result into the same behaviour. Signed-off-by: Michal Privoznik Reviewed-by: Peter Krempa --- diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c index af14c6bed7..6c729801d4 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -469,11 +469,7 @@ dissect_libvirt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, val_to_str(prog, program_strings, "%x")); vs = get_program_data(prog, VIR_PROGRAM_PROCSTRINGS); - if (vs == NULL) { - col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=%d", proc); - } else { - col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=%s", val_to_str(proc, vs, "%d")); - } + col_append_fstr(pinfo->cinfo, COL_INFO, " Proc=%s", val_to_str(proc, vs, "%d")); col_append_fstr(pinfo->cinfo, COL_INFO, " Type=%s Serial=%u Status=%s", val_to_str(type, type_strings, "%d"), serial,