fetchmail-friends
[Top] [All Lists]

[fetchmail]PATCH: fix xmalloc types

2002-06-07 04:16:44
This patch cleans up the xmalloc data types. Please apply before
6.0.0. If any offsets are mentioned against the fetchmail.h, disregard
them, there were more patch hunks in my fetchmail.h version that I
dropped because they are for 6.0.1. The /*(_at_)null@*/ comment is for
lint-like static C checkers such as splint (formerly known as lclint).

Index: xmalloc.c
===================================================================
RCS file: /var/CVS/fetchmail/xmalloc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- xmalloc.c   2002/06/03 14:27:04     1.1.1.1
+++ xmalloc.c   2002/06/03 14:28:02     1.2
@@ -6,6 +6,7 @@
  */
 
 #include "config.h"
+#include <sys/types.h>
 #include <stdio.h>
 #include <errno.h>
 #include <string.h>
@@ -22,7 +23,7 @@
 #endif
 
 XMALLOCTYPE *
-xmalloc (int n)
+xmalloc (size_t n)
 {
     XMALLOCTYPE *p;
 
@@ -36,7 +37,7 @@
 }
 
 XMALLOCTYPE *
-xrealloc (XMALLOCTYPE *p, int n)
+xrealloc (XMALLOCTYPE *p, size_t n)
 {
     if (p == 0)
        return xmalloc (n);
Index: fetchmail.h
===================================================================
RCS file: /var/CVS/fetchmail/fetchmail.h,v
retrieving revision 1.1.1.5
retrieving revision 1.6
diff -u -r1.1.1.5 -r1.6
--- fetchmail.h 2002/06/05 16:31:42     1.1.1.5
+++ fetchmail.h 2002/06/05 16:33:14     1.6
@@ -5,6 +5,9 @@
 /* We need this for HAVE_STDARG_H, etc */
 #include "config.h"
 
+/* We need this for size_t */
+#include <sys/types.h>
+
 /* constants designating the various supported protocols */
 #define                P_AUTO          1
 #define                P_POP2          2
@@ -549,8 +554,8 @@
 #else
 #define XMALLOCTYPE char
 #endif
-XMALLOCTYPE *xmalloc(int);
-XMALLOCTYPE *xrealloc(XMALLOCTYPE *, int);
+XMALLOCTYPE *xmalloc(size_t);
+XMALLOCTYPE *xrealloc(/*(_at_)null@*/ XMALLOCTYPE *, size_t);
 char *xstrdup(const char *);
 #if defined(HAVE_ALLOCA_H)
 #include <alloca.h>


-- 
Matthias Andree


<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail]PATCH: fix xmalloc types, Matthias Andree <=