Lines Matching refs:parent
63 struct ralloc_header *parent;
92 add_child(ralloc_header *parent, ralloc_header *info)
94 if (parent != NULL) {
95 info->parent = parent;
96 info->next = parent->child;
97 parent->child = info;
123 ralloc_header *parent;
133 info->parent = NULL;
139 parent = ctx != NULL ? get_header(ctx) : NULL;
141 add_child(parent, info);
174 /* Update parent and sibling's links to the reallocated node. */
175 if (info != old && info->parent != NULL) {
176 if (info->parent->child == old)
177 info->parent->child = info;
186 /* Update child->parent links for all children */
188 child->parent = info;
271 /* Unlink from parent & siblings */
272 if (info->parent != NULL) {
273 if (info->parent->child == info)
274 info->parent->child = info->next;
282 info->parent = NULL;
308 ralloc_header *info, *parent;
314 parent = new_ctx ? get_header(new_ctx) : NULL;
318 add_child(parent, info);
336 /* Set all the children's parent to new_ctx; get a pointer to the last child. */
338 child->parent = new_info;
340 child->parent = new_info;
342 /* Connect the two lists together; parent them to new_ctx; make old_ctx empty. */
359 return info->parent ? PTR_FROM_HEADER(info->parent) : NULL;
539 * The allocator consists of a parent node (2K buffer), which requires
540 * a ralloc parent, and child nodes (allocations). Child nodes can't be freed
541 * directly, because the parent doesn't track them. You have to release
542 * the parent node in order to release all its children.
546 * is allocated, sharing the same ralloc parent, so all buffers are at
549 * The linear parent node is always the first buffer and keeps track of all
597 #define LINEAR_PARENT_TO_HEADER(parent) \
599 ((char*)(parent) - sizeof(linear_size_chunk) - sizeof(linear_header))
628 linear_alloc_child(void *parent, unsigned size)
630 linear_header *first = LINEAR_PARENT_TO_HEADER(parent);
682 linear_zalloc_child(void *parent, unsigned size)
684 void *ptr = linear_alloc_child(parent, size);
692 linear_zalloc_parent(void *parent, unsigned size)
694 void *ptr = linear_alloc_parent(parent, size);
747 linear_realloc(void *parent, void *old, unsigned new_size)
752 new_ptr = linear_alloc_child(parent, new_size);
770 linear_strdup(void *parent, const char *str)
779 ptr = linear_alloc_child(parent, n + 1);
789 linear_asprintf(void *parent, const char *fmt, ...)
794 ptr = linear_vasprintf(parent, fmt, args);
800 linear_vasprintf(void *parent, const char *fmt, va_list args)
804 char *ptr = linear_alloc_child(parent, size);
812 linear_asprintf_append(void *parent, char **str, const char *fmt, ...)
817 success = linear_vasprintf_append(parent, str, fmt, args);
823 linear_vasprintf_append(void *parent, char **str, const char *fmt, va_list args)
828 return linear_vasprintf_rewrite_tail(parent, str, &existing_length, fmt, args);
832 linear_asprintf_rewrite_tail(void *parent, char **str, size_t *start,
838 success = linear_vasprintf_rewrite_tail(parent, str, start, fmt, args);
844 linear_vasprintf_rewrite_tail(void *parent, char **str, size_t *start,
853 *str = linear_vasprintf(parent, fmt, args);
860 ptr = linear_realloc(parent, *str, *start + new_length + 1);
872 linear_cat(void *parent, char **dest, const char *str, unsigned n)
879 both = linear_realloc(parent, *dest, existing_length + n + 1);
891 linear_strcat(void *parent, char **dest, const char *str)
893 return linear_cat(parent, dest, str, strlen(str));