]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "make more dict functions take const"
authorAlan T. DeKok <aland@freeradius.org>
Tue, 5 Nov 2019 16:41:41 +0000 (11:41 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 5 Nov 2019 16:58:19 +0000 (11:58 -0500)
This reverts commit 8f063890eb37823f362c22843d2a9db87ebe907f.

src/lib/util/dict.h
src/lib/util/dict_tokenize.c
src/lib/util/dict_util.c

index c5aad803d85652dd6dafb24e23a72064d09d0e6e..02716ed05dc4a232df38bdd4e2ff974dc2efd523 100644 (file)
@@ -245,7 +245,7 @@ extern bool const   fr_dict_non_data_types[FR_TYPE_MAX + 1];
  *
  * @{
  */
-int                    fr_dict_attr_add(fr_dict_t const *dict, fr_dict_attr_t const *parent, char const *name, int attr,
+int                    fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent, char const *name, int attr,
                                         fr_type_t type, fr_dict_attr_flags_t const *flags) CC_HINT(nonnull(1,2,3));
 
 int                    fr_dict_enum_add_alias(fr_dict_attr_t const *da, char const *alias,
@@ -394,7 +394,7 @@ int                 fr_dict_internal_afrom_file(fr_dict_t **out, char const *internal_name);
 
 int                    fr_dict_protocol_afrom_file(fr_dict_t **out, char const *proto_name, char const *proto_dir);
 
-int                    fr_dict_read(fr_dict_t const *dict, char const *dict_dir, char const *filename);
+int                    fr_dict_read(fr_dict_t *dict, char const *dict_dir, char const *filename);
 /** @} */
 
 /** @name Autoloader interface
index 95edf7650ad34f00ba486df0ebc93d979836e00d..017587f94ae52fd20e3c83c96c17a732517d7865 100644 (file)
@@ -2401,9 +2401,8 @@ int fr_dict_protocol_afrom_file(fr_dict_t **out, char const *proto_name, char co
  *     - 0 on success.
  *      - -1 on failure.
  */
-int fr_dict_read(fr_dict_t const *dict, char const *dir, char const *filename)
+int fr_dict_read(fr_dict_t *dict, char const *dir, char const *filename)
 {
-       fr_dict_t *mutable;
        INTERNAL_IF_NULL(dict, -1);
 
        if (!dict->attributes_by_name) {
@@ -2411,8 +2410,7 @@ int fr_dict_read(fr_dict_t const *dict, char const *dir, char const *filename)
                return -1;
        }
 
-       memcpy(&mutable, &dict, sizeof(dict));
-       return dict_from_file(mutable, dir, filename, NULL, 0);
+       return dict_from_file(dict, dir, filename, NULL, 0);
 }
 
 /*
index 833de6a487742aab0527318b044672686e310939..a7fe0854fa608bd18fc142a40653e87a4cecdf4f 100644 (file)
@@ -851,7 +851,7 @@ int dict_attr_add_by_name(fr_dict_t *dict, fr_dict_attr_t *da)
 
 /** Add an attribute to the dictionary
  *
- * @param[in] const_dict               of protocol context we're operating in.
+ * @param[in] dict             of protocol context we're operating in.
  *                             If NULL the internal dictionary will be used.
  * @param[in] parent           to add attribute under.
  * @param[in] name             of the attribute.
@@ -862,16 +862,13 @@ int dict_attr_add_by_name(fr_dict_t *dict, fr_dict_attr_t *da)
  *     - 0 on success.
  *     - -1 on failure.
  */
-int fr_dict_attr_add(fr_dict_t const *const_dict, fr_dict_attr_t const *parent,
+int fr_dict_attr_add(fr_dict_t *dict, fr_dict_attr_t const *parent,
                     char const *name, int attr, fr_type_t type, fr_dict_attr_flags_t const *flags)
 {
        fr_dict_attr_t          *n;
        fr_dict_attr_t const    *old;
        fr_dict_attr_t          *mutable;
        fr_dict_attr_flags_t    our_flags = *flags;
-       fr_dict_t               *dict;
-
-       memcpy(&dict, &const_dict, sizeof(const_dict)); /* const issues */
 
        /*
         *      Check that the definition is valid.
@@ -2358,17 +2355,14 @@ int fr_dict_autoload(fr_dict_autoload_t const *to_load)
  */
 void fr_dict_autofree(fr_dict_autoload_t const *to_free)
 {
-       fr_dict_t const                 **dict;
+       fr_dict_t                       **dict;
        fr_dict_autoload_t const        *p;
 
        for (p = to_free; p->out; p++) {
-               fr_dict_t **mutable;
                dict = p->out;
                if (!*dict) continue;
 
-               memcpy(&mutable, &dict, sizeof(dict)); /* const issues */
-
-               fr_dict_free(mutable);
+               fr_dict_free(dict);
        }
 }