]> sjero.net Git - wget/blobdiff - src/xmalloc.h
[svn] Don't cast return type of malloc/realloc. Assume ANSI C signal handlers.
[wget] / src / xmalloc.h
index ed2a188dba9083e1b8a600127e87be612e98d67b..94f3aaaad0e842d148dacda434d4c038b1f7f556 100644 (file)
@@ -30,9 +30,10 @@ so, delete this exception statement from your version.  */
 #ifndef XMALLOC_H
 #define XMALLOC_H
 
-/* Define this to get Wget's builtin malloc debugging, which is
-   primitive but fairly extensive.  It will make Wget somewhat slower
-   and larger, so it should be used by developers only.  */
+/* Define this to use Wget's builtin malloc debugging, which is crude
+   but occasionally useful.  It will make Wget a lot slower and
+   larger, and susceptible to aborting if malloc_table overflows, so
+   it should be used by developers only.  */
 #undef DEBUG_MALLOC
 
 /* When DEBUG_MALLOC is not defined (which is normally the case), the
@@ -55,11 +56,11 @@ so, delete this exception statement from your version.  */
 #define xstrdup  checking_strdup
 #define xfree    checking_free
 
-void *checking_malloc PARAMS ((size_t));
-void *checking_malloc0 PARAMS ((size_t));
-void *checking_realloc PARAMS ((void *, size_t));
-char *checking_strdup PARAMS ((const char *));
-void checking_free PARAMS ((void *));
+void *checking_malloc (size_t);
+void *checking_malloc0 (size_t);
+void *checking_realloc (void *, size_t);
+char *checking_strdup (const char *);
+void checking_free (void *);
 
 #else  /* DEBUG_MALLOC */
 
@@ -69,11 +70,11 @@ void checking_free PARAMS ((void *));
 #define xstrdup(p)     debugging_strdup (p, __FILE__, __LINE__)
 #define xfree(p)       debugging_free (p, __FILE__, __LINE__)
 
-void *debugging_malloc PARAMS ((size_t, const char *, int));
-void *debugging_malloc0 PARAMS ((size_t, const char *, int));
-void *debugging_realloc PARAMS ((void *, size_t, const char *, int));
-char *debugging_strdup PARAMS ((const char *, const char *, int));
-void debugging_free PARAMS ((void *, const char *, int));
+void *debugging_malloc (size_t, const char *, int);
+void *debugging_malloc0 (size_t, const char *, int);
+void *debugging_realloc (void *, size_t, const char *, int);
+char *debugging_strdup (const char *, const char *, int);
+void debugging_free (void *, const char *, int);
 
 #endif /* DEBUG_MALLOC */
 
@@ -82,10 +83,10 @@ void debugging_free PARAMS ((void *, const char *, int));
    necessary in standard C, but Wget performs them anyway for the sake
    of pre-standard environments and possibly C++.  */
 
-#define xnew(type) ((type *) xmalloc (sizeof (type)))
-#define xnew0(type) ((type *) xmalloc0 (sizeof (type)))
-#define xnew_array(type, len) ((type *) xmalloc ((len) * sizeof (type)))
-#define xnew0_array(type, len) ((type *) xmalloc0 ((len) * sizeof (type)))
+#define xnew(type) (xmalloc (sizeof (type)))
+#define xnew0(type) (xmalloc0 (sizeof (type)))
+#define xnew_array(type, len) (xmalloc ((len) * sizeof (type)))
+#define xnew0_array(type, len) (xmalloc0 ((len) * sizeof (type)))
 
 #define alloca_array(type, size) ((type *) alloca ((size) * sizeof (type)))