]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
use macros to simplify / standardize logic
authorAlan T. DeKok <aland@freeradius.org>
Thu, 8 Aug 2019 17:26:46 +0000 (13:26 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 8 Aug 2019 23:20:39 +0000 (19:20 -0400)
src/lib/util/dict.c

index 2b6980dca652ac038ea6000cbb399b784a82798c..fc081713927f3601e43cc765fa91d5a40c412eaa 100644 (file)
@@ -630,7 +630,8 @@ static bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent,
        if (flags->extra) {
                switch (type) {
                case FR_TYPE_EXTENDED:
-                       if ((all_flags & ~shift_extra) != 0) {
+                       ALLOW_FLAG(extra);
+                       if (all_flags) {
                                fr_strerror_printf("The 'long' flag cannot be used with any other flags.");
                                return false;
                        }
@@ -639,7 +640,8 @@ static bool dict_attr_flags_valid(fr_dict_t *dict, fr_dict_attr_t const *parent,
                case FR_TYPE_UINT8:
                case FR_TYPE_UINT16:
                case FR_TYPE_UINT32:
-                       if ((all_flags & ~shift_extra) != 0) {
+                       ALLOW_FLAG(extra);
+                       if (all_flags) {
                                fr_strerror_printf("The 'key' flag cannot be used with any other flags.");
                                return false;
                        }