radeonsi: clean up shader value metadata code
[mesa.git] / src / util / ralloc.c
index bb4cf9612eb3c28683dbae82eeefe643648a1b95..9526011b83674079815a21b744187c593480e689 100644 (file)
@@ -109,6 +109,18 @@ ralloc_context(const void *ctx)
 
 void *
 ralloc_size(const void *ctx, size_t size)
+{
+   /* ralloc_size was originally implemented using calloc, which meant some
+    * code accidentally relied on its zero filling behavior.
+    *
+    * TODO: Make ralloc_size not zero fill memory, and cleanup any code that
+    * should instead be using rzalloc.
+    */
+   return rzalloc_size(ctx, size);
+}
+
+void *
+rzalloc_size(const void *ctx, size_t size)
 {
    void *block = calloc(1, size + sizeof(ralloc_header));
    ralloc_header *info;
@@ -128,15 +140,6 @@ ralloc_size(const void *ctx, size_t size)
    return PTR_FROM_HEADER(info);
 }
 
-void *
-rzalloc_size(const void *ctx, size_t size)
-{
-   void *ptr = ralloc_size(ctx, size);
-   if (likely(ptr != NULL))
-      memset(ptr, 0, size);
-   return ptr;
-}
-
 /* helper function - assumes ptr != NULL */
 static void *
 resize(void *ptr, size_t size)
@@ -293,6 +296,7 @@ ralloc_adopt(const void *new_ctx, void *old_ctx)
 
    /* Connect the two lists together; parent them to new_ctx; make old_ctx empty. */
    child->next = new_info->child;
+   child->parent = new_info;
    new_info->child = old_info->child;
    old_info->child = NULL;
 }