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
This commit is contained in:
Guy Harris 2004-12-20 22:13:48 +00:00
parent 8e36c366f8
commit e20d80ea57
4 changed files with 7 additions and 15 deletions

View File

@ -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,

View File

@ -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);

View File

@ -69,8 +69,6 @@
#define DebugLog(x) ;
#endif
#define PLURALIZE(x) ((x) == 1 ? "" : "s")
#define IMG_JFIF "image-jfif"
/************************** Variable declarations **************************/

View File

@ -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 */
}