]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
add fr_pair_init_null()
authorAlan T. DeKok <aland@freeradius.org>
Tue, 5 Apr 2022 12:31:14 +0000 (08:31 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 5 Apr 2022 12:58:53 +0000 (08:58 -0400)
because memset(vp, 0) is no longer appropriate

src/lib/util/pair.c
src/lib/util/pair.h

index 7e933e5ca6963705156dd10a433d94c4885e3f16..cdcfdd66ba28d2989494a7d8e4eb2ee45e547b2c 100644 (file)
@@ -115,6 +115,17 @@ static inline CC_HINT(always_inline) void pair_init_null(fr_pair_t *vp)
        vp->op = T_OP_EQ;
 }
 
+/** Initialise fields in an fr_pair_t without assigning a da
+ *
+ *  Used only for temporary value-pairs which are not placed in any list.
+ */
+void fr_pair_init_null(fr_pair_t *vp)
+{
+       memset(vp, 0, sizeof(*vp));
+
+       pair_init_null(vp);
+}
+
 /** Dynamically allocate a new attribute with no #fr_dict_attr_t assigned
  *
  * This is not the function you're looking for (unless you're binding
index a85ce47e907c3ebbd86d2c527231f45d5693f469..7c23023fdbc62c9398557170304dccbd356765ec 100644 (file)
@@ -186,6 +186,8 @@ DIAG_ON(nonnull-compare)
 /* Initialisation */
 void fr_pair_list_init(fr_pair_list_t *head) CC_HINT(nonnull);
 
+void fr_pair_init_null(fr_pair_t *vp) CC_HINT(nonnull);
+
 /* Allocation and management */
 fr_pair_t      *fr_pair_alloc_null(TALLOC_CTX *ctx) CC_HINT(warn_unused_result);