2013-09-26 17:14:40 +02:00

48 lines
958 B
Plaintext

$NetBSD: patch-aa,v 1.6 2012/04/16 04:01:10 dholland Exp $
- Use standard headers.
- Don't declare own errno.
- Don't declare own malloc/free/lseek.
- Remove wrong cast calling malloc.
--- sdbm.c.orig 2004-04-27 19:10:43.000000000 -0500
+++ sdbm.c
@@ -25,6 +25,10 @@
#endif
#include <errno.h>
#include <string.h>
+#include <stdlib.h>
+
+/* To define SEEK_SET on Linux */
+#include <stdio.h>
#ifdef __STDC__
#include <stddef.h>
@@ -35,17 +39,6 @@
#endif
/*
- * externals
- */
-#ifndef sun
-extern int errno;
-#endif
-
-extern char *malloc proto((unsigned int));
-extern void free proto((void *));
-extern long lseek();
-
-/*
* forward
*/
static int getdbit proto((DBM *, long));
@@ -95,7 +88,7 @@ register int mode;
*/
n = strlen(file) * 2 + strlen(DIRFEXT) + strlen(PAGFEXT) + 2;
- if ((dirname = malloc((unsigned) n)) == NULL)
+ if ((dirname = malloc(n)) == NULL)
return errno = ENOMEM, (DBM *) NULL;
/*
* build the file names