]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Fix issues raised by GCC
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 11 May 2018 11:25:44 +0000 (17:25 +0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 11 May 2018 11:25:44 +0000 (17:25 +0600)
src/include/cursor.h
src/include/pair.h
src/lib/util/pair.c
src/main/cf_parse.c

index c394b7888d7378d24ba3fbfea0b656ca4e70504b..30410304d4f23f009bd5f49a5c90def97fe42d36 100644 (file)
@@ -95,7 +95,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull);
  *     - The first item returned by the iterator.
  */
 #define fr_cursor_talloc_iter_init(_cursor, _head, _iter, _ctx, _type) \
-       _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, #_type)
+       _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, #_type)
 
 /** Initialise a cursor with a custom iterator
  *
@@ -109,7 +109,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull);
  *     - The first item returned by the iterator.
  */
 #define fr_cursor_iter_init(_cursor, _head, _iter, _ctx) \
-       _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, NULL)
+       _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), _iter, _ctx, NULL)
 
 /** Initialise a cursor with runtime talloc type safety checks
  *
@@ -121,7 +121,7 @@ void fr_cursor_free_list(fr_cursor_t *cursor) CC_HINT(nonnull);
  *     - The first item in the list.
  */
 #define fr_cursor_talloc_init(_cursor, _head, _type) \
-       _fr_cursor_init(_cursor, (void * const *)_head, offsetof(__typeof__(**(_head)), next), NULL, NULL, #_type)
+       _fr_cursor_init(_cursor, (void **)_head, offsetof(__typeof__(**(_head)), next), NULL, NULL, #_type)
 
 /** Initialise a cursor
  *
index 8c53adbce22446346020485cfd4b52f7f9663256..b7901194d02eaafe4e65f9f6d0d547d3b00b57a8 100644 (file)
@@ -263,15 +263,15 @@ int               fr_pair_list_afrom_file(TALLOC_CTX *ctx, VALUE_PAIR **out, FILE *fp, bool *
 
 int            fr_pair_list_copy(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR *from);
 int            fr_pair_list_copy_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                                       VALUE_PAIR const *from, fr_dict_attr_t const *da);
+                                       VALUE_PAIR *from, fr_dict_attr_t const *da);
 int            fr_pair_list_copy_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                                             VALUE_PAIR const *from, fr_dict_attr_t const *parent_da);
+                                             VALUE_PAIR *from, fr_dict_attr_t const *parent_da);
 
 void           fr_pair_list_move(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from);
 int            fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                                       VALUE_PAIR const *from, fr_dict_attr_t const *da);
+                                       VALUE_PAIR **from, fr_dict_attr_t const *da);
 int            fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                                             VALUE_PAIR const *from, fr_dict_attr_t const *da);
+                                             VALUE_PAIR **from, fr_dict_attr_t const *da);
 
 /* Value manipulation */
 int            fr_pair_value_from_str(VALUE_PAIR *vp, char const *value, size_t len);
index e15e983c49c6ac8056d72f2298be6d6b19493583..236ba721b5c33782a822850f18532281daa03baf 100644 (file)
@@ -1689,7 +1689,7 @@ int fr_pair_list_copy(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR *from)
  *     - -1 on error.
  */
 int fr_pair_list_copy_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                           VALUE_PAIR const *from, fr_dict_attr_t const *da)
+                           VALUE_PAIR *from, fr_dict_attr_t const *da)
 {
        fr_cursor_t     src, dst, tmp;
 
@@ -1742,7 +1742,7 @@ int fr_pair_list_copy_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
  *     - -1 on error.
  */
 int fr_pair_list_copy_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                                 VALUE_PAIR const *from, fr_dict_attr_t const *parent_da)
+                                 VALUE_PAIR *from, fr_dict_attr_t const *parent_da)
 {
        fr_cursor_t     src, dst, tmp;
 
@@ -1946,7 +1946,7 @@ void fr_pair_list_move(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR **from)
  *     - 0 if no pairs were moved.
  */
 int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
-                           VALUE_PAIR const *from, fr_dict_attr_t const *da)
+                           VALUE_PAIR **from, fr_dict_attr_t const *da)
 {
        fr_cursor_t     src, dst;
 
@@ -1959,7 +1959,7 @@ int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
        }
 
        fr_cursor_talloc_init(&dst, to, VALUE_PAIR);
-       for (vp = fr_cursor_talloc_iter_init(&src, &from, fr_pair_iter_next_by_da, da, VALUE_PAIR);
+       for (vp = fr_cursor_talloc_iter_init(&src, from, fr_pair_iter_next_by_da, da, VALUE_PAIR);
             vp;
             vp = fr_cursor_next(&src), cnt++) {
                VP_VERIFY(vp);
@@ -1984,8 +1984,8 @@ int fr_pair_list_move_by_da(TALLOC_CTX *ctx, VALUE_PAIR **to,
  *     - >0 number of pairs moved.
  *     - 0 if no pairs were moved.
  */
-int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR const *from,
-                                 fr_dict_attr_t const *parent_da)
+int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to,
+                                 VALUE_PAIR **from, fr_dict_attr_t const *parent_da)
 {
        fr_cursor_t     src, dst;
 
@@ -1998,7 +1998,7 @@ int fr_pair_list_move_by_ancestor(TALLOC_CTX *ctx, VALUE_PAIR **to, VALUE_PAIR c
        }
 
        fr_cursor_talloc_init(&dst, to, VALUE_PAIR);
-       for (vp = fr_cursor_talloc_iter_init(&src, &from, fr_pair_iter_next_by_ancestor, parent_da, VALUE_PAIR);
+       for (vp = fr_cursor_talloc_iter_init(&src, from, fr_pair_iter_next_by_ancestor, parent_da, VALUE_PAIR);
             vp;
             vp = fr_cursor_next(&src), cnt++) {
                VP_VERIFY(vp);
index f5437c656e013d181251aa420b04334567a26c0b..53cd6ee4ca98832885399fc390c3692da1b510ad 100644 (file)
@@ -89,8 +89,16 @@ static inline int CC_HINT(nonnull) fr_item_validate_ipaddr(CONF_SECTION *cs, cha
                default:
                        return -1;
                }
-       default:
                return 0;
+
+       case FR_TYPE_IPV4_PREFIX:
+       case FR_TYPE_IPV6_PREFIX:
+       case FR_TYPE_COMBO_IP_PREFIX:
+               return 0;
+
+       default:
+               rad_assert(0);
+               return -1;
        }
 }