+/*
+ Allocate a bit of memory as a child of an existing pointer
+*/
+static inline void *__talloc(const void *context, size_t size)
+{
+ struct talloc_chunk *tc;
+ struct talloc_chunk *parent = NULL;
+ int external = 0;
+
+ if (unlikely(context == NULL)) {
+ context = null_context;
+ }
+
+ if (unlikely(size >= MAX_TALLOC_SIZE)) {
+ return NULL;
+ }
+
+ if (likely(context)) {
+ parent = talloc_chunk_from_ptr(context);
+ if (unlikely(parent->flags & TALLOC_FLAG_EXT_ALLOC)) {
+ tc = tc_external_realloc(context, NULL,
+ TC_HDR_SIZE+size);
+ external = 1;
+ goto alloc_done;
+ }
+ }
+
+ tc = (struct talloc_chunk *)malloc(TC_HDR_SIZE+size);
+alloc_done:
+ return init_talloc(parent, tc, size, external);
+}
+