From: Alan T. DeKok Date: Thu, 18 May 2023 20:47:57 +0000 (-0400) Subject: remove unused argument to fr_pair_update_by_da() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=02ccc86fa118a0239a25e7fa51e89f8181c01c2f;p=thirdparty%2Ffreeradius-server.git remove unused argument to fr_pair_update_by_da() --- diff --git a/src/lib/server/pair.h b/src/lib/server/pair.h index 44e03a6c344..3a7b85e6d9f 100644 --- a/src/lib/server/pair.h +++ b/src/lib/server/pair.h @@ -115,7 +115,7 @@ RCSIDH(server_pair_h, "$Id$") * - 0 if we allocated a new attribute. * - -1 on failure. */ -#define pair_update_request(_attr, _da) fr_pair_update_by_da(request->request_ctx, _attr, _da, 0) +#define pair_update_request(_attr, _da) fr_pair_update_by_da(request->request_ctx, _attr, _da) /** Return or allocate a fr_pair_t in the reply list * @@ -126,7 +126,7 @@ RCSIDH(server_pair_h, "$Id$") * - 0 if we allocated a new attribute. * - -1 on failure. */ -#define pair_update_reply(_attr, _da) fr_pair_update_by_da(request->reply_ctx, _attr, _da, 0) +#define pair_update_reply(_attr, _da) fr_pair_update_by_da(request->reply_ctx, _attr, _da) /** Return or allocate a fr_pair_t in the control list * @@ -137,7 +137,7 @@ RCSIDH(server_pair_h, "$Id$") * - 0 if we allocated a new attribute. * - -1 on failure. */ -#define pair_update_control(_attr, _da) fr_pair_update_by_da(request->control_ctx, _attr, _da, 0) +#define pair_update_control(_attr, _da) fr_pair_update_by_da(request->control_ctx, _attr, _da) /** Return or allocate a fr_pair_t in the session_state list * @@ -148,7 +148,7 @@ RCSIDH(server_pair_h, "$Id$") * - 0 if we allocated a new attribute. * - -1 on failure. */ -#define pair_update_session_state(_attr, _da) fr_pair_update_by_da(request->session_state_ctx, _attr, _da, 0) +#define pair_update_session_state(_attr, _da) fr_pair_update_by_da(request->session_state_ctx, _attr, _da) /** Delete one or move fr_pair_t in a list * diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index fad173e8bc9..9847e0a6d6f 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -1483,21 +1483,17 @@ int fr_pair_append_by_da_parent(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_t * @param[out] out Pair we allocated or found. May be NULL if the caller doesn't * care about manipulating the fr_pair_t. * @param[in] da of attribute to locate or alloc. - * @param[in] n update the n'th instance of this da. - * Note: If we can't find the n'th instance the attribute created - * won't necessarily be at index n. So use cases for this are - * limited . * @return * - 1 if attribute already existed. * - 0 if we allocated a new attribute. * - -1 on failure. */ int fr_pair_update_by_da(fr_pair_t *parent, fr_pair_t **out, - fr_dict_attr_t const *da, unsigned int n) + fr_dict_attr_t const *da) { fr_pair_t *vp; - vp = fr_pair_find_by_da_idx(&parent->vp_group, da, n); + vp = fr_pair_find_by_da_idx(&parent->vp_group, da, 0); if (vp) { PAIR_VERIFY_WITH_LIST(&parent->vp_group, vp); if (out) *out = vp; diff --git a/src/lib/util/pair.h b/src/lib/util/pair.h index 5132d99196b..4748d12cefd 100644 --- a/src/lib/util/pair.h +++ b/src/lib/util/pair.h @@ -502,7 +502,7 @@ int fr_pair_append_by_da_parent(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_ fr_dict_attr_t const *da) CC_HINT(nonnull(3,4)); int fr_pair_update_by_da(fr_pair_t *parent, fr_pair_t **out, - fr_dict_attr_t const *da, unsigned int n) CC_HINT(nonnull(1,3)); + fr_dict_attr_t const *da) CC_HINT(nonnull(1,3)); int fr_pair_delete_by_da(fr_pair_list_t *head, fr_dict_attr_t const *da) CC_HINT(nonnull); diff --git a/src/lib/util/pair_tests.c b/src/lib/util/pair_tests.c index 91c4edba242..0549cd998a4 100644 --- a/src/lib/util/pair_tests.c +++ b/src/lib/util/pair_tests.c @@ -530,7 +530,7 @@ static void test_fr_pair_update_by_da(void) TEST_CHECK((group = fr_pair_afrom_da(autofree, fr_dict_attr_test_group)) != NULL); TEST_CASE("Update Add using fr_pair_prepend_by_da()"); - TEST_CHECK(fr_pair_update_by_da(group, &vp, fr_dict_attr_test_uint32, 0) == 0); /* attribute doesn't exist in this group */ + TEST_CHECK(fr_pair_update_by_da(group, &vp, fr_dict_attr_test_uint32) == 0); /* attribute doesn't exist in this group */ vp->vp_uint32 = 54321; TEST_CASE("Expected fr_dict_attr_test_uint32 (vp->vp_uint32 == 54321)");