summaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-07-21 14:30:32 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-07-21 14:30:32 +0000
commita9c2e59b866ff50ebd41fe9b3079a26f10901ca7 (patch)
tree4674180ab2fe1211dabde45475083d6b9bb736b4 /usr.bin/patch
parent4728da71a971314d072eb52bac15221ee135316d (diff)
remove a bit more junk
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/common.h21
-rw-r--r--usr.bin/patch/inp.c18
-rw-r--r--usr.bin/patch/pch.c16
-rw-r--r--usr.bin/patch/util.c6
4 files changed, 20 insertions, 41 deletions
diff --git a/usr.bin/patch/common.h b/usr.bin/patch/common.h
index 22512185130..fb5cfc1423e 100644
--- a/usr.bin/patch/common.h
+++ b/usr.bin/patch/common.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.h,v 1.14 2003/07/21 14:00:41 deraadt Exp $ */
+/* $OpenBSD: common.h,v 1.15 2003/07/21 14:30:31 deraadt Exp $ */
#define DEBUGGING
@@ -24,15 +24,8 @@
/* constants */
-/* AIX predefines these. */
-#ifdef TRUE
-#undef TRUE
-#endif
-#ifdef FALSE
-#undef FALSE
-#endif
-#define TRUE (1)
-#define FALSE (0)
+#define TRUE 1
+#define FALSE 0
#define MAXHUNKSIZE 100000 /* is this enough lines? */
#define INITHUNKMAX 125 /* initial dynamic allocation size */
@@ -68,7 +61,6 @@
typedef char bool;
typedef long LINENUM; /* must be signed */
-typedef unsigned MEM; /* what to feed malloc */
/* globals */
@@ -135,10 +127,3 @@ EXT char else_defined[] INIT("#else\n"); /* #else */
EXT char end_defined[128]; /* #endif xyzzy */
EXT char *revision INIT(Nullch); /* prerequisite revision, if any */
-
-#if !defined(S_ISDIR) && defined(S_IFDIR)
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISREG) && defined(S_IFREG)
-#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
-#endif
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index ecea07e9c7b..411c7984647 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: inp.c,v 1.12 2003/07/21 14:00:41 deraadt Exp $ */
+/* $OpenBSD: inp.c,v 1.13 2003/07/21 14:30:31 deraadt Exp $ */
#ifndef lint
-static char rcsid[] = "$OpenBSD: inp.c,v 1.12 2003/07/21 14:00:41 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: inp.c,v 1.13 2003/07/21 14:30:31 deraadt Exp $";
#endif /* not lint */
#include "EXTERN.h"
@@ -170,13 +170,7 @@ plan_a(char *filename)
out_of_mem = FALSE;
return FALSE; /* force plan b because plan a bombed */
}
-#ifdef lint
- i_womp = Nullch;
-#else
- i_womp = malloc((MEM) (i_size + 2)); /* lint says this may alloc
- * less than */
- /* i_size, but that's okay, I think. */
-#endif
+ i_womp = malloc(i_size + 2);
if (i_womp == Nullch)
return FALSE;
if ((ifd = open(filename, O_RDONLY)) < 0)
@@ -203,7 +197,7 @@ plan_a(char *filename)
#ifdef lint
i_ptr = Null(char **);
#else
- i_ptr = (char **) malloc((MEM) ((iline + 2) * sizeof(char *)));
+ i_ptr = (char **) malloc((iline + 2) * sizeof(char *));
#endif
if (i_ptr == Null(char **)) { /* shucks, it was a near thing */
free((char *) i_womp);
@@ -293,10 +287,10 @@ plan_b(char *filename)
fseek(ifp, 0L, 0); /* rewind file */
lines_per_buf = BUFFERSIZE / maxlen;
tireclen = maxlen;
- tibuf[0] = malloc((MEM) (BUFFERSIZE + 1));
+ tibuf[0] = malloc(BUFFERSIZE + 1);
if (tibuf[0] == Nullch)
fatal("out of memory\n");
- tibuf[1] = malloc((MEM) (BUFFERSIZE + 1));
+ tibuf[1] = malloc(BUFFERSIZE + 1);
if (tibuf[1] == Nullch)
fatal("out of memory\n");
for (i = 1;; i++) {
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index 2000b5e2c46..d251635a18e 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: pch.c,v 1.18 2003/07/21 14:27:35 deraadt Exp $ */
+/* $OpenBSD: pch.c,v 1.19 2003/07/21 14:30:31 deraadt Exp $ */
#ifndef lint
-static char rcsid[] = "$OpenBSD: pch.c,v 1.18 2003/07/21 14:27:35 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pch.c,v 1.19 2003/07/21 14:30:31 deraadt Exp $";
#endif /* not lint */
#include "EXTERN.h"
@@ -82,12 +82,12 @@ set_hunkmax(void)
{
#ifndef lint
if (p_line == Null(char **))
- p_line = (char **) malloc((MEM) hunkmax * sizeof(char *));
+ p_line = (char **) malloc((size_t) hunkmax * sizeof(char *));
if (p_len == Null(short *))
- p_len = (short *) malloc((MEM) hunkmax * sizeof(short));
+ p_len = (short *) malloc((size_t) hunkmax * sizeof(short));
#endif
if (p_char == Nullch)
- p_char = (char *) malloc((MEM) hunkmax * sizeof(char));
+ p_char = (char *) malloc((size_t) hunkmax * sizeof(char));
}
/*
@@ -105,9 +105,9 @@ grow_hunkmax(void)
*/
assert(p_line != Null(char **) &&p_len != Null(short *) &&p_char != Nullch);
#ifndef lint
- p_line = (char **) realloc((char *) p_line, (MEM) hunkmax * sizeof(char *));
- p_len = (short *) realloc((char *) p_len, (MEM) hunkmax * sizeof(short));
- p_char = (char *) realloc((char *) p_char, (MEM) hunkmax * sizeof(char));
+ p_line = (char **) realloc((char *) p_line, hunkmax * sizeof(char *));
+ p_len = (short *) realloc((char *) p_len, hunkmax * sizeof(short));
+ p_char = (char *) realloc((char *) p_char, hunkmax * sizeof(char));
#endif
if (p_line != Null(char **) &&p_len != Null(short *) &&p_char != Nullch)
return;
diff --git a/usr.bin/patch/util.c b/usr.bin/patch/util.c
index 7074bf3c5d3..e026e9de342 100644
--- a/usr.bin/patch/util.c
+++ b/usr.bin/patch/util.c
@@ -1,7 +1,7 @@
-/* $OpenBSD: util.c,v 1.13 2003/07/21 14:00:41 deraadt Exp $ */
+/* $OpenBSD: util.c,v 1.14 2003/07/21 14:30:31 deraadt Exp $ */
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.13 2003/07/21 14:00:41 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.14 2003/07/21 14:30:31 deraadt Exp $";
#endif /* not lint */
#include "EXTERN.h"
@@ -166,7 +166,7 @@ savestr(char *s)
t = s;
while (*t++)
;
- rv = malloc((MEM) (t - s));
+ rv = malloc((size_t) (t - s));
if (rv == Nullch) {
if (using_plan_a)
out_of_mem = TRUE;