From: Arran Cudbard-Bell Date: Mon, 11 Oct 2021 03:45:31 +0000 (-0500) Subject: Remove manual NULL checks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69b560c36bf11582e80d21f0a034d456656c476e;p=thirdparty%2Ffreeradius-server.git Remove manual NULL checks --- diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 35298cd47b5..5bbe9bcac84 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -332,8 +332,6 @@ fr_pair_t *fr_pair_copy(TALLOC_CTX *ctx, fr_pair_t const *vp) { fr_pair_t *n; - if (!vp) return NULL; - VP_VERIFY(vp); n = fr_pair_afrom_da(ctx, vp->da); @@ -511,8 +509,6 @@ void *fr_pair_iter_next_by_da(fr_dlist_head_t *list, void *to_eval, void *uctx) fr_pair_t *c; fr_dict_attr_t *da = uctx; - if (!to_eval) return NULL; - for (c = to_eval; c; c = fr_dlist_next(list, c)) { VP_VERIFY(c); if (c->da == da) break; @@ -536,8 +532,6 @@ void *fr_pair_iter_next_by_ancestor(fr_dlist_head_t *list, void *to_eval, void * fr_pair_t *c; fr_dict_attr_t *da = uctx; - if (!to_eval) return NULL; - for (c = to_eval; c; c = fr_dlist_next(list, c)) { VP_VERIFY(c); if (fr_dict_attr_common_parent(da, c->da, true)) break; @@ -1645,8 +1639,6 @@ int fr_pair_value_copy(fr_pair_t *dst, fr_pair_t *src) */ int fr_pair_value_from_str(fr_pair_t *vp, char const *value, ssize_t inlen, char quote, bool tainted) { - if (!value) return -1; - /* * This is not yet supported because the rest of the APIs * to parse pair names, etc. don't yet enforce "inlen". @@ -2238,8 +2230,6 @@ int fr_pair_value_enum_box(fr_value_box_t const **out, fr_pair_t *vp) { fr_dict_enum_value_t const *dv; - if (!out || !vp ) return -1; - if (vp->da && vp->da->flags.has_value && (dv = fr_dict_enum_by_value(vp->da, &vp->data))) { *out = dv->value; @@ -2256,10 +2246,6 @@ int fr_pair_value_enum_box(fr_value_box_t const **out, fr_pair_t *vp) */ void fr_pair_verify(char const *file, int line, fr_pair_t const *vp) { - if (!vp) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t pointer was NULL", file, line); - } - (void) talloc_get_type_abort_const(vp, fr_pair_t); if (!vp->da) { diff --git a/src/lib/util/pair_print.c b/src/lib/util/pair_print.c index 0b299a2c18e..9dee92ad40e 100644 --- a/src/lib/util/pair_print.c +++ b/src/lib/util/pair_print.c @@ -103,10 +103,6 @@ ssize_t fr_pair_print(fr_sbuff_t *out, fr_pair_t const *parent, fr_pair_t const fr_sbuff_t our_out = FR_SBUFF_NO_ADVANCE(out); fr_dict_attr_t const *parent_da = NULL; - if (!out) return 0; - - if (!vp || !vp->da) return 0; - VP_VERIFY(vp); if ((vp->op > T_INVALID) && (vp->op < T_TOKEN_LAST)) { @@ -144,7 +140,6 @@ void fr_pair_fprint(FILE *fp, fr_pair_t const *vp) char buff[1024]; fr_sbuff_t sbuff = FR_SBUFF_OUT(buff, sizeof(buff)); - if (!fp) return; VP_VERIFY(vp); fr_sbuff_in_char(&sbuff, '\t');