cf_item_mark_parsed(cp_p);
}
- slen = talloc_array_concat(agg, array, kctx->string_sep);
+ slen = fr_sbuff_array_concat(agg, array, kctx->string_sep);
talloc_free(array);
if (slen < 0) return -1;
extern "C" {
#endif
-#include <freeradius-devel/util/talloc.h>
+#include <freeradius-devel/util/sbuff.h>
#include <stdbool.h>
#ifdef HAVE_DIRENT_H
/* This is the central step in the MD4 algorithm. */
#define MD4STEP(f, w, x, y, z, data, s) (w += f(x, y, z) + data, w = w << s | w >> (32 - s))
+DIAG_OFF(cast-align)
+
/** The core of the MD4 algorithm
*
* This alters an existing MD4 hash to reflect the addition of 16
return 0;
}
+DIAG_OFF(cast-align)
+
/** Resolve a uid to a passwd entry
*
* Resolves a uid to a passwd entry. The memory to hold the
fprintf(fp, "<none>\n");
}
}
+
+/** Concat an array of strings (not NULL terminated), with a string separator
+ *
+ * @param[out] out Where to write the resulting string.
+ * @param[in] array of strings to concat.
+ * @param[in] sep to insert between elements. May be NULL.
+ * @return
+ * - >= 0 on success - length of the string created.
+ * - <0 on failure. How many bytes we would need.
+ */
+fr_slen_t fr_sbuff_array_concat(fr_sbuff_t *out, char const * const *array, char const *sep)
+{
+ fr_sbuff_t our_out = FR_SBUFF(out);
+ size_t len = talloc_array_length(array);
+ char const * const * p;
+ char const * const * end;
+ fr_sbuff_escape_rules_t e_rules = {
+ .name = __FUNCTION__,
+ .chr = '\\'
+ };
+
+ if (sep) e_rules.subs[(uint8_t)*sep] = *sep;
+
+ for (p = array, end = array + len;
+ (p < end);
+ p++) {
+ if (*p) FR_SBUFF_RETURN(fr_sbuff_in_escape, &our_out, *p, strlen(*p), &e_rules);
+
+ if (sep && ((p + 1) < end)) {
+ FR_SBUFF_RETURN(fr_sbuff_in_strcpy, &our_out, sep);
+ }
+ }
+
+ FR_SBUFF_SET_RETURN(out, &our_out);
+}
*/
#define fr_sbuff_as_percent_s(_sbuff) (int) fr_sbuff_remaining(_sbuff), fr_sbuff_current(_sbuff)
+fr_slen_t fr_sbuff_array_concat(fr_sbuff_t *out, char const * const *array, char const *sep) CC_HINT(nonnull(1,2));
+
+
#ifdef __cplusplus
}
#endif
return new;
}
-/** Concat an array of strings (not NULL terminated), with a string separator
- *
- * @param[out] out Where to write the resulting string.
- * @param[in] array of strings to concat.
- * @param[in] sep to insert between elements. May be NULL.
- * @return
- * - >= 0 on success - length of the string created.
- * - <0 on failure. How many bytes we would need.
- */
-fr_slen_t talloc_array_concat(fr_sbuff_t *out, char const * const *array, char const *sep)
-{
- fr_sbuff_t our_out = FR_SBUFF(out);
- size_t len = talloc_array_length(array);
- char const * const * p;
- char const * const * end;
- fr_sbuff_escape_rules_t e_rules = {
- .name = __FUNCTION__,
- .chr = '\\'
- };
-
- if (sep) e_rules.subs[(uint8_t)*sep] = *sep;
-
- for (p = array, end = array + len;
- (p < end);
- p++) {
- if (*p) FR_SBUFF_RETURN(fr_sbuff_in_escape, &our_out, *p, strlen(*p), &e_rules);
-
- if (sep && ((p + 1) < end)) {
- FR_SBUFF_RETURN(fr_sbuff_in_strcpy, &our_out, sep);
- }
- }
-
- FR_SBUFF_SET_RETURN(out, &our_out);
-}
-
/** Callback to free the autofree ctx on global exit
*
*/
#include <freeradius-devel/autoconf.h> /* Very easy to miss including in special builds */
#include <freeradius-devel/build.h>
#include <freeradius-devel/missing.h>
-#include <freeradius-devel/util/sbuff.h>
#undef talloc_autofree_context
/** The original function is deprecated, so replace it with our version
void **talloc_array_null_strip(void **array);
-fr_slen_t talloc_array_concat(fr_sbuff_t *out, char const * const *array, char const *sep);
-
-
/** Free const'd memory
*
* @param[in] ptr to free.