From: Alan T. DeKok Date: Thu, 29 Sep 2022 21:15:41 +0000 (-0400) Subject: rename "is_counter" to "counter" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b0486cc70ea0bb0ac42d9a2fe5264e171fc85ef;p=thirdparty%2Ffreeradius-server.git rename "is_counter" to "counter" and add it to the flags being printed --- diff --git a/src/lib/util/dict.h b/src/lib/util/dict.h index 5b4aa2d3f4c..eda4c353b21 100644 --- a/src/lib/util/dict.h +++ b/src/lib/util/dict.h @@ -93,7 +93,7 @@ typedef struct { unsigned int is_unsigned : 1; //!< hackity hack for dates and time deltas - unsigned int is_counter : 1; //!< integer attribute is actually an impulse / counter + unsigned int counter : 1; //!< integer attribute is actually an impulse / counter /* * @todo - if we want to clean these fields up, make diff --git a/src/lib/util/dict_print.c b/src/lib/util/dict_print.c index 3ce87178765..b7d6b3aaeb4 100644 --- a/src/lib/util/dict_print.c +++ b/src/lib/util/dict_print.c @@ -40,6 +40,7 @@ ssize_t fr_dict_attr_flags_print(fr_sbuff_t *out, fr_dict_t const *dict, fr_type FLAG_SET(array); FLAG_SET(has_value); FLAG_SET(virtual); + FLAG_SET(counter); if (dict && !flags->extra && flags->subtype) { FR_SBUFF_IN_STRCPY_RETURN(&our_out, fr_table_str_by_value(dict->subtype_table, flags->subtype, "?")); diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 7fb0fdb6d6d..e8d499568e1 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -372,7 +372,7 @@ static int dict_process_flag_field(dict_tokenize_ctx_t *ctx, char *name, fr_type flags->array = 1; } else if (strcmp(key, "counter") == 0) { - flags->is_counter = 1; + flags->counter = 1; } else if (strcmp(key, "virtual") == 0) { flags->virtual = 1; diff --git a/src/lib/util/dict_validate.c b/src/lib/util/dict_validate.c index 23f5e999f12..80b2f483111 100644 --- a/src/lib/util/dict_validate.c +++ b/src/lib/util/dict_validate.c @@ -45,7 +45,7 @@ bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent, uint32_t shift_is_root, shift_internal; uint32_t shift_array, shift_has_value; uint32_t shift_virtual, shift_subtype, shift_extra; - uint32_t shift_is_counter; + uint32_t shift_counter; fr_dict_attr_t const *v; /* @@ -62,7 +62,7 @@ bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent, SET_FLAG(has_value); SET_FLAG(virtual); SET_FLAG(extra); - SET_FLAG(is_counter); + SET_FLAG(counter); SET_FLAG(subtype); #define FORBID_OTHER_FLAGS(_flag) do { if (all_flags & ~shift_ ## _flag) { fr_strerror_printf("The '" STRINGIFY(_flag) "' flag cannot be used with any other flag"); return false; } } while (0) @@ -493,9 +493,9 @@ bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent, * For other data types, we don't know how to * automatically add two counters. */ - if (flags->is_counter) { + if (flags->counter) { if ((type == FR_TYPE_TIME_DELTA) || (fr_type_is_integer(type) && !fr_type_is_signed(type))) { - ALLOW_FLAG(is_counter); + ALLOW_FLAG(counter); } else { fr_strerror_printf("The 'counter' flag cannot be used with '%s'", fr_type_to_str(type)); return false;