TALLOC_CTX not always available
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Apr 2015 22:15:10 +0000 (18:15 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 9 Apr 2015 22:38:54 +0000 (18:38 -0400)
src/include/missing-h
src/lib/missing.c

index e3a57b2..c022158 100644 (file)
@@ -442,5 +442,5 @@ typedef void(*sig_t)(int);
  */
 char *talloc_typed_strdup(const void *t, const char *p);
 char *talloc_typed_asprintf(const void *t, const char *fmt, ...) CC_HINT(format (printf, 2, 3));
-char *talloc_strndup_bs(TALLOC_CTX *ctx, char const *in, size_t inlen);
+char *talloc_strndup_bs(const void *t, char const *in, size_t inlen);
 #endif /* _FR_MISSING_H */
index 0fea5ef..18785a5 100644 (file)
@@ -340,16 +340,16 @@ char *talloc_typed_asprintf(void const *t, char const *fmt, ...)
 
 /** Binary safe strndup function
  *
- * @param[in] ctx to allocate new buffer in.
+ * @param[in] t The talloc context o allocate new buffer in.
  * @param[in] in String to dup, may contain embedded '\0'.
  * @param[in] inlen Number of bytes to dup.
  * @return duped string.
  */
-char *talloc_strndup_bs(TALLOC_CTX *ctx, char const *in, size_t inlen)
+char *talloc_strndup_bs(void const *t, char const *in, size_t inlen)
 {
        char *p;
 
-       p = talloc_array(ctx, char, inlen + 1);
+       p = talloc_array(t, char, inlen + 1);
        if (!p) return NULL;
        memcpy(p, in, inlen);
        p[inlen] = '\0';