From a9586625d1002fdb800303a464691d85d4da91df Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 23 Feb 2020 14:32:15 +0100 Subject: ta: remove ta_find_parent() Some mpv code once needed this, but it was removed in 2015. --- ta/ta.c | 16 ---------------- ta/ta.h | 1 - ta/ta_talloc.h | 1 - 3 files changed, 18 deletions(-) diff --git a/ta/ta.c b/ta/ta.c index 817ccfd3ab..fffc1a6602 100644 --- a/ta/ta.c +++ b/ta/ta.c @@ -291,22 +291,6 @@ bool ta_set_destructor(void *ptr, void (*destructor)(void *)) return true; } -/* Return the ptr's parent allocation, or NULL if there isn't any. - * - * Warning: this has O(N) runtime complexity with N sibling allocations! - */ -void *ta_find_parent(void *ptr) -{ - struct ta_header *h = get_header(ptr); - if (!h || !h->next) - return NULL; - for (struct ta_header *cur = h->next; cur != h; cur = cur->next) { - if (cur->size == CHILDREN_SENTINEL) - return PTR_FROM_HEADER(cur->ext->header); - } - return NULL; -} - #ifdef TA_MEMORY_DEBUGGING #include diff --git a/ta/ta.h b/ta/ta.h index 18d8caf368..4450795be8 100644 --- a/ta/ta.h +++ b/ta/ta.h @@ -52,7 +52,6 @@ void ta_free(void *ptr); void ta_free_children(void *ptr); bool ta_set_destructor(void *ptr, void (*destructor)(void *)); bool ta_set_parent(void *ptr, void *ta_parent); -void *ta_find_parent(void *ptr); // Utility functions size_t ta_calc_array_size(size_t element_size, size_t count); diff --git a/ta/ta_talloc.h b/ta/ta_talloc.h index c2c8ac953d..f2413c0112 100644 --- a/ta/ta_talloc.h +++ b/ta/ta_talloc.h @@ -38,7 +38,6 @@ #define talloc_realloc_size ta_xrealloc_size #define talloc_new ta_xnew_context #define talloc_set_destructor ta_xset_destructor -#define talloc_parent ta_find_parent #define talloc_enable_leak_report ta_enable_leak_report #define talloc_size ta_xalloc_size #define talloc_zero_size ta_xzalloc_size -- cgit v1.2.3