From 2a9f7c35a5837413a158d53a0982adae425065c6 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@debian.org>
Date: Tue, 14 Jan 2014 10:34:01 +0000
Subject: Remove/update declarations conflicting with <stdlib.h>

The incorrect memory allocation prototypes may have broken on some
64-bit systems.

Patch-Name: stdlib.patch
---
 browser-history.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/browser-history.c b/browser-history.c
index e500e79..b1303ed 100644
--- a/browser-history.c
+++ b/browser-history.c
@@ -8,6 +8,8 @@
  * See http://www.inria.fr/koala/colas/browser-history
  */
 /* Checkpoint patch by J C Lawrence, 2000. */
+/* Modifications for Debian GNU/Linux distribution by Karl M. Hegbloom, 1997,
+ * and Colin Watson, 2001. */
 char *RCS_ID = "$Id: browser-history.c,v 2.8 2000/07/25 15:46:26 colas Exp $";
 static char VERSION[8];
 /* Compile with:
@@ -17,6 +19,7 @@ static char VERSION[8];
 #define _POSIX_SOURCE			/* for solaris (sigaction) */
 #define __USE_FIXED_PROTOTYPES__	/* for sunos (stdio.h) */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <ctype.h>
 #include <X11/Xos.h>
@@ -178,18 +181,11 @@ char *monthname[] = {
     "August", "September", "October", "November", "December"};
 
 /******************************************************************* imports */
-extern char *malloc(int bytes);		/* WARNING: Dont use these! */
-extern char *realloc(void *ptr, int bytes);
-extern void free(void *ptr);
-
 extern Window XmuClientWindow (Display *dpy, Window win);
-extern char *getenv(const char *);
 extern char *strdup(const char *);
 #define streq !strcmp
 /* extern char *strchr(const char *s, int c); */
-extern int atoi(char *s);
 extern int gethostname(char *name, size_t len);
-extern int system(char *command);
 
 /********************************************************** forward declares */
 void initialize(int argc, char **argv);
@@ -229,8 +225,8 @@ void init_last_entry();
 FILE *add_log_day(FILE *fd, struct tm *times);
 
 /* Use these to prevent abortion in case of memory full situations */
-char *Malloc(int bytes);		
-char *Realloc(void *ptr, int bytes);
+char *Malloc(size_t bytes);		
+char *Realloc(void *ptr, size_t bytes);
 char *Strdup(char *);
 #define Free(x) free(x)			/* for coherence */
 
@@ -1195,9 +1191,9 @@ decode_ARENA_LOCATION(char *full_name, char **namep, char **urlp)
     while(!(retvalue = original args)) sleep(10); \
     return (ret_type) retvalue;}
 
-GUARD_FUNCTION(malloc, Malloc, char *, (int bytes), (bytes))
+GUARD_FUNCTION(malloc, Malloc, char *, (size_t bytes), (bytes))
    
-GUARD_FUNCTION(realloc, Realloc, char *, (void *ptr, int bytes), (ptr, bytes))
+GUARD_FUNCTION(realloc, Realloc, char *, (void *ptr, size_t bytes), (ptr, bytes))
 
 GUARD_FUNCTION(strdup, Strdup, char *, (char *string), (string))
 
