depot/third_party/nixpkgs/pkgs/tools/graphics/xcur2png/malloc.diff

34 lines
610 B
Diff
Raw Normal View History

--- a/xcur2png.c
+++ b/xcur2png.c
@@ -16,7 +16,10 @@
/* Todo: atoi error handling */
/* help is -h in manual */
+#if HAVE_CONFIG_H
#include <config.h>
+#endif
+#undef malloc
#define _ATFILE_SOURCE
#include <stdio.h>
@@ -34,6 +37,19 @@
#include <png.h>
#include <X11/Xcursor/Xcursor.h>
+
+void *malloc ();
+
+/* Allocate an N-byte block of memory from the heap.
+ If N is zero, allocate a 1-byte block. */
+
+void* rpl_malloc (size_t n)
+{
+ if (n == 0)
+ n = 1;
+ return malloc (n);
+}
+
#define PNG_SETJMP_NOT_SUPPORTED 1
#define PROGRESS_SHARPS 50 /* total number of progress sharps */