summaryrefslogtreecommitdiff
path: root/sysutils/xdu/patches/patch-aa
blob: fe53abcf0dcbdf3588bd28f78f2d323ddf633e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
$NetBSD: patch-aa,v 1.5 2006/06/08 15:39:25 joerg Exp $

--- xdu.c.orig	2006-06-08 15:35:16.000000000 +0000
+++ xdu.c
@@ -19,13 +19,13 @@
  * limitation a license to do the foregoing actions under any patents of
  * the party supplying this software to the X Consortium.
  */
+#include <assert.h>
 #include <stdio.h>
+#include <string.h>
 #include "version.h"
 
-extern char *malloc(), *calloc();
-
-#define	MAXDEPTH	80	/* max elements in a path */
-#define	MAXNAME		1024	/* max pathname element length */
+#define	MAXDEPTH	1024	/* max elements in a path */
+#define	MAXNAME		4096	/* max pathname element length */
 #define	MAXPATH		4096	/* max total pathname length */
 #define	NCOLS		5	/* default number of columns in display */
 
@@ -96,6 +96,10 @@ int size;
 	struct	node	*np;
 
 	np = (struct node *)calloc(1,sizeof(struct node));
+	if (np == NULL) {
+		fprintf(stderr, "Out of memory! (#1)\n");
+		exit(1);
+	}
 	np->name = strdup(name);
 	np->size = size;
 	np->num = nnodes;
@@ -610,20 +614,6 @@ pwd()
 		100.0*topp->size/rootp->size);
 }
 
-char *
-strdup(s)
-char *s;
-{
-	int	n;
-	char	*cp;
-
-	n = strlen(s);
-	cp = malloc(n+1);
-	strcpy(cp,s);
-
-	return	cp;
-}
-
 /**************** External Entry Points ****************/
 
 int