From e20d80ea570eec39cd3426cead33af107c489e16 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 20 Dec 2004 22:13:48 +0000 Subject: [PATCH] Use "plurality()" rather than locally-defined "PLURALIZE()" macros, and get rid of the definition of "PLURALIZE()" in modules that don't use it. svn path=/trunk/; revision=12791 --- epan/dissectors/packet-bootp.c | 2 -- epan/dissectors/packet-image-gif.c | 10 ++++------ epan/dissectors/packet-image-jfif.c | 2 -- epan/dissectors/packet-wsp.c | 8 +++----- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 65cbbca13f..da086cd19c 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -148,8 +148,6 @@ static const true_false_string tfs_fqdn_n = { "Some server updates" }; -#define PLURALIZE(n) (((n) > 1) ? "s" : "") - enum field_type { special, none, diff --git a/epan/dissectors/packet-image-gif.c b/epan/dissectors/packet-image-gif.c index c58d5f5a56..1d93eb14d3 100644 --- a/epan/dissectors/packet-image-gif.c +++ b/epan/dissectors/packet-image-gif.c @@ -66,8 +66,6 @@ #define DebugLog(x) ; #endif -#define PLURALIZE(x) ((x) == 1 ? "" : "s") - #define IMG_GIF "image-gif" /************************** Variable declarations **************************/ @@ -227,8 +225,8 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) proto_item_append_text(ti, " (Global color table present)"); proto_item_append_text(ti, " (%u bit%s per color) (%u bit%s per pixel)", - color_resolution, PLURALIZE(color_resolution), - image_bpp, PLURALIZE(image_bpp)); + color_resolution, plurality(color_resolution, "", "s"), + image_bpp, plurality(image_bpp, "", "s")); subtree = proto_item_add_subtree(ti, ett_global_flags); proto_tree_add_item(subtree, hf_global_color_map_present, tvb, 10, 1, TRUE); @@ -392,8 +390,8 @@ dissect_gif(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) proto_item_append_text(ti2, " (Local color table present)"); proto_item_append_text(ti2, " (%u bit%s per color) (%u bit%s per pixel)", - color_resolution, PLURALIZE(color_resolution), - image_bpp, PLURALIZE(image_bpp)); + color_resolution, plurality(color_resolution, "", "s"), + image_bpp, plurality(image_bpp, "", "s")); subtree2 = proto_item_add_subtree(ti2, ett_local_flags); proto_tree_add_item(subtree2, hf_local_color_map_present, tvb, offset, 1, TRUE); diff --git a/epan/dissectors/packet-image-jfif.c b/epan/dissectors/packet-image-jfif.c index 0efa4e4e56..896cb03b7c 100644 --- a/epan/dissectors/packet-image-jfif.c +++ b/epan/dissectors/packet-image-jfif.c @@ -69,8 +69,6 @@ #define DebugLog(x) ; #endif -#define PLURALIZE(x) ((x) == 1 ? "" : "s") - #define IMG_JFIF "image-jfif" /************************** Variable declarations **************************/ diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index 6d61150b63..b6e1edf226 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -64,8 +64,6 @@ #include "packet-wap.h" #include "packet-wsp.h" -#define PLURALIZE(x) ( (x) == 1 ? "" : "s" ) - /* General-purpose debug logger. * Requires double parentheses because of variable arguments of printf(). * @@ -2908,7 +2906,7 @@ wkh_age(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _ wkh_1_WellKnownValue; val = val_id & 0x7F; - val_str = g_strdup_printf("%u second%s", val, PLURALIZE(val)); + val_str = g_strdup_printf("%u second%s", val, plurality(val, "", "s")); ti = proto_tree_add_string(tree, hf_hdr_age, tvb, hdr_start, offset - hdr_start, val_str); g_free(val_str); /* proto_XXX creates a copy */ @@ -2919,7 +2917,7 @@ wkh_age(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _ if (val_id <= 4) { /* Length field already parsed by macro! */ get_long_integer(val, tvb, off, len, ok); if (ok) { - val_str = g_strdup_printf("%u second%s", val, PLURALIZE(val)); + val_str = g_strdup_printf("%u second%s", val, plurality(val, "", "s")); ti = proto_tree_add_string(tree, hf_hdr_age, tvb, hdr_start, offset - hdr_start, val_str); g_free(val_str); /* proto_XXX creates a copy */ @@ -3365,7 +3363,7 @@ wkh_cache_control(proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_inf get_delta_seconds_value(val, tvb, off, len, ok); if (ok) { val_str = g_strdup_printf("=%u second%s", - val, PLURALIZE(val)); + val, plurality(val, "", "s")); proto_item_append_string(ti, val_str); g_free(val_str); /* proto_XXX creates a copy */ }