Lines Matching refs:parent

57    struct ralloc_header *parent;
86 add_child(ralloc_header *parent, ralloc_header *info)
88 if (parent != NULL) {
89 info->parent = parent;
90 info->next = parent->child;
91 parent->child = info;
117 ralloc_header *parent;
127 info->parent = NULL;
133 parent = ctx != NULL ? get_header(ctx) : NULL;
135 add_child(parent, info);
168 /* Update parent and sibling's links to the reallocated node. */
169 if (info != old && info->parent != NULL) {
170 if (info->parent->child == old)
171 info->parent->child = info;
180 /* Update child->parent links for all children */
182 child->parent = info;
265 /* Unlink from parent & siblings */
266 if (info->parent != NULL) {
267 if (info->parent->child == info)
268 info->parent->child = info->next;
276 info->parent = NULL;
302 ralloc_header *info, *parent;
308 parent = new_ctx ? get_header(new_ctx) : NULL;
312 add_child(parent, info);
330 /* Set all the children's parent to new_ctx; get a pointer to the last child. */
332 child->parent = new_info;
334 child->parent = new_info;
336 /* Connect the two lists together; parent them to new_ctx; make old_ctx empty. */
353 return info->parent ? PTR_FROM_HEADER(info->parent) : NULL;
533 * The allocator consists of a parent node (2K buffer), which requires
534 * a ralloc parent, and child nodes (allocations). Child nodes can't be freed
535 * directly, because the parent doesn't track them. You have to release
536 * the parent node in order to release all its children.
540 * is allocated, sharing the same ralloc parent, so all buffers are at
543 * The linear parent node is always the first buffer and keeps track of all
591 #define LINEAR_PARENT_TO_HEADER(parent) \
593 ((char*)(parent) - sizeof(linear_size_chunk) - sizeof(linear_header))
622 linear_alloc_child(void *parent, unsigned size)
624 linear_header *first = LINEAR_PARENT_TO_HEADER(parent);
676 linear_zalloc_child(void *parent, unsigned size)
678 void *ptr = linear_alloc_child(parent, size);
686 linear_zalloc_parent(void *parent, unsigned size)
688 void *ptr = linear_alloc_parent(parent, size);
741 linear_realloc(void *parent, void *old, unsigned new_size)
746 new_ptr = linear_alloc_child(parent, new_size);
764 linear_strdup(void *parent, const char *str)
773 ptr = linear_alloc_child(parent, n + 1);
783 linear_asprintf(void *parent, const char *fmt, ...)
788 ptr = linear_vasprintf(parent, fmt, args);
794 linear_vasprintf(void *parent, const char *fmt, va_list args)
798 char *ptr = linear_alloc_child(parent, size);
806 linear_asprintf_append(void *parent, char **str, const char *fmt, ...)
811 success = linear_vasprintf_append(parent, str, fmt, args);
817 linear_vasprintf_append(void *parent, char **str, const char *fmt, va_list args)
822 return linear_vasprintf_rewrite_tail(parent, str, &existing_length, fmt, args);
826 linear_asprintf_rewrite_tail(void *parent, char **str, size_t *start,
832 success = linear_vasprintf_rewrite_tail(parent, str, start, fmt, args);
838 linear_vasprintf_rewrite_tail(void *parent, char **str, size_t *start,
847 *str = linear_vasprintf(parent, fmt, args);
854 ptr = linear_realloc(parent, *str, *start + new_length + 1);
866 linear_cat(void *parent, char **dest, const char *str, unsigned n)
873 both = linear_realloc(parent, *dest, existing_length + n + 1);
885 linear_strcat(void *parent, char **dest, const char *str)
887 return linear_cat(parent, dest, str, strlen(str));