summaryrefslogtreecommitdiff
path: root/lib/mesa/src/util/ralloc.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2016-12-11 08:40:05 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2016-12-11 08:40:05 +0000
commit21ab4c9f31674b113c24177398ed39f29b7cd8e6 (patch)
tree8be392d7a792d9663c2586396be77bfd506f5164 /lib/mesa/src/util/ralloc.c
parenta8f0a7916e26e550dd2a26e7188835c481978004 (diff)
Import Mesa 13.0.2
Diffstat (limited to 'lib/mesa/src/util/ralloc.c')
-rw-r--r--lib/mesa/src/util/ralloc.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/mesa/src/util/ralloc.c b/lib/mesa/src/util/ralloc.c
index 6d4032bd4..9526011b8 100644
--- a/lib/mesa/src/util/ralloc.c
+++ b/lib/mesa/src/util/ralloc.c
@@ -110,6 +110,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;
ralloc_header *parent;
@@ -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)