Lines Matching refs:parent
69 struct ralloc_header *parent;
98 add_child(ralloc_header *parent, ralloc_header *info)
100 if (parent != NULL) {
101 info->parent = parent;
102 info->next = parent->child;
103 parent->child = info;
121 ralloc_header *parent;
131 info->parent = NULL;
137 parent = ctx != NULL ? get_header(ctx) : NULL;
139 add_child(parent, info);
171 /* Update parent and sibling's links to the reallocated node. */
172 if (info != old && info->parent != NULL) {
173 if (info->parent->child == old)
174 info->parent->child = info;
183 /* Update child->parent links for all children */
185 child->parent = info;
243 /* Unlink from parent & siblings */
244 if (info->parent != NULL) {
245 if (info->parent->child == info)
246 info->parent->child = info->next;
254 info->parent = NULL;
280 ralloc_header *info, *parent;
286 parent = new_ctx ? get_header(new_ctx) : NULL;
290 add_child(parent, info);
308 /* Set all the children's parent to new_ctx; get a pointer to the last child. */
310 child->parent = new_info;
312 child->parent = new_info;
314 /* Connect the two lists together; parent them to new_ctx; make old_ctx empty. */
331 return info->parent ? PTR_FROM_HEADER(info->parent) : NULL;
540 * The allocator consists of a parent node (2K buffer), which requires
541 * a ralloc parent, and child nodes (allocations). Child nodes can't be freed
542 * directly, because the parent doesn't track them. You have to release
543 * the parent node in order to release all its children.
547 * is allocated, sharing the same ralloc parent, so all buffers are at
550 * The linear parent node is always the first buffer and keeps track of all
598 #define LINEAR_PARENT_TO_HEADER(parent) \
600 ((char*)(parent) - sizeof(linear_size_chunk) - sizeof(linear_header))
629 linear_alloc_child(void *parent, unsigned size)
631 linear_header *first = LINEAR_PARENT_TO_HEADER(parent);
683 linear_zalloc_child(void *parent, unsigned size)
685 void *ptr = linear_alloc_child(parent, size);
693 linear_zalloc_parent(void *parent, unsigned size)
695 void *ptr = linear_alloc_parent(parent, size);
748 linear_realloc(void *parent, void *old, unsigned new_size)
753 new_ptr = linear_alloc_child(parent, new_size);
771 linear_strdup(void *parent, const char *str)
780 ptr = linear_alloc_child(parent, n + 1);
790 linear_asprintf(void *parent, const char *fmt, ...)
795 ptr = linear_vasprintf(parent, fmt, args);
801 linear_vasprintf(void *parent, const char *fmt, va_list args)
805 char *ptr = linear_alloc_child(parent, size);
813 linear_asprintf_append(void *parent, char **str, const char *fmt, ...)
818 success = linear_vasprintf_append(parent, str, fmt, args);
824 linear_vasprintf_append(void *parent, char **str, const char *fmt, va_list args)
829 return linear_vasprintf_rewrite_tail(parent, str, &existing_length, fmt, args);
833 linear_asprintf_rewrite_tail(void *parent, char **str, size_t *start,
839 success = linear_vasprintf_rewrite_tail(parent, str, start, fmt, args);
845 linear_vasprintf_rewrite_tail(void *parent, char **str, size_t *start,
854 *str = linear_vasprintf(parent, fmt, args);
861 ptr = linear_realloc(parent, *str, *start + new_length + 1);
873 linear_cat(void *parent, char **dest, const char *str, unsigned n)
880 both = linear_realloc(parent, *dest, existing_length + n + 1);
892 linear_strcat(void *parent, char **dest, const char *str)
894 return linear_cat(parent, dest, str, strlen(str));