Module Name: src
Committed By: matt
Date: Fri May 20 13:34:11 UTC 2011
Modified Files:
src/usr.bin/sort [matt-nb5-mips64]: fsort.c msort.c sort.h
Log Message:
bring matt-nb5-mips64 up to date with netbsd-5-1-RELEASE
To generate a diff of this commit:
cvs rdiff -u -r1.32.12.1 -r1.32.12.2 src/usr.bin/sort/fsort.c
cvs rdiff -u -r1.18.12.1 -r1.18.12.2 src/usr.bin/sort/msort.c
cvs rdiff -u -r1.19.12.1 -r1.19.12.2 src/usr.bin/sort/sort.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/sort/fsort.c
diff -u src/usr.bin/sort/fsort.c:1.32.12.1 src/usr.bin/sort/fsort.c:1.32.12.2
--- src/usr.bin/sort/fsort.c:1.32.12.1 Wed Apr 21 05:27:12 2010
+++ src/usr.bin/sort/fsort.c Fri May 20 13:34:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fsort.c,v 1.32.12.1 2010/04/21 05:27:12 matt Exp $ */
+/* fsort.c,v 1.32.12.1 2010/04/21 05:27:12 matt Exp */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
#include "fsort.h"
#ifndef lint
-__RCSID("$NetBSD: fsort.c,v 1.32.12.1 2010/04/21 05:27:12 matt Exp $");
+__RCSID("fsort.c,v 1.32.12.1 2010/04/21 05:27:12 matt Exp");
__SCCSID("@(#)fsort.c 8.1 (Berkeley) 6/6/93");
#endif /* not lint */
@@ -98,7 +98,7 @@
int file_no;
int max_recs = DEBUG('m') ? 16 : MAXNUM;
- buffer = malloc(bufsize);
+ buffer = allocrec(NULL, bufsize);
bufend = (u_char *)buffer + bufsize;
/* Allocate double length keymap for radix_sort */
keylist = malloc(2 * max_recs * sizeof(*keylist));
@@ -157,7 +157,7 @@
/* c == BUFFEND, and we can process more data */
/* Allocate a larger buffer for this lot of data */
bufsize *= 2;
- nbuffer = realloc(buffer, bufsize);
+ nbuffer = allocrec(buffer, bufsize);
if (!nbuffer) {
err(2, "failed to realloc buffer to %zu bytes",
bufsize);
Index: src/usr.bin/sort/msort.c
diff -u src/usr.bin/sort/msort.c:1.18.12.1 src/usr.bin/sort/msort.c:1.18.12.2
--- src/usr.bin/sort/msort.c:1.18.12.1 Wed Apr 21 05:27:12 2010
+++ src/usr.bin/sort/msort.c Fri May 20 13:34:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: msort.c,v 1.18.12.1 2010/04/21 05:27:12 matt Exp $ */
+/* msort.c,v 1.18.12.1 2010/04/21 05:27:12 matt Exp */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
#include "fsort.h"
#ifndef lint
-__RCSID("$NetBSD: msort.c,v 1.18.12.1 2010/04/21 05:27:12 matt Exp $");
+__RCSID("msort.c,v 1.18.12.1 2010/04/21 05:27:12 matt Exp");
__SCCSID("@(#)msort.c 8.1 (Berkeley) 6/6/93");
#endif /* not lint */
@@ -209,7 +209,7 @@
for (nfiles = i = 0; i < fstack_count; i++) {
cfile = &fstack[i];
if (cfile->rec == NULL) {
- cfile->rec = emalloc(DEFLLEN);
+ cfile->rec = allocrec(NULL, DEFLLEN);
cfile->end = (u_char *)cfile->rec + DEFLLEN;
}
rewind(cfile->fp);
@@ -222,7 +222,7 @@
if (c == BUFFEND) {
/* Double buffer size */
sz = (cfile->end - (u_char *)cfile->rec) * 2;
- cfile->rec = erealloc(cfile->rec, sz);
+ cfile->rec = allocrec(cfile->rec, sz);
cfile->end = (u_char *)cfile->rec + sz;
continue;
}
@@ -248,7 +248,7 @@
* output file - maintaining one record from each file in the sorted
* list.
*/
- new_rec = emalloc(DEFLLEN);
+ new_rec = allocrec(NULL, DEFLLEN);
new_end = (u_char *)new_rec + DEFLLEN;
for (;;) {
cfile = flist[0];
@@ -266,7 +266,7 @@
if (c == BUFFEND) {
/* Buffer not large enough - double in size */
sz = (new_end - (u_char *)new_rec) * 2;
- new_rec = erealloc(new_rec, sz);
+ new_rec = allocrec(new_rec, sz);
new_end = (u_char *)new_rec +sz;
continue;
}
Index: src/usr.bin/sort/sort.h
diff -u src/usr.bin/sort/sort.h:1.19.12.1 src/usr.bin/sort/sort.h:1.19.12.2
--- src/usr.bin/sort/sort.h:1.19.12.1 Wed Apr 21 05:27:12 2010
+++ src/usr.bin/sort/sort.h Fri May 20 13:34:11 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: sort.h,v 1.19.12.1 2010/04/21 05:27:12 matt Exp $ */
+/* $NetBSD: sort.h,v 1.19.12.2 2011/05/20 13:34:11 matt Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@@ -174,6 +174,7 @@
#define DEBUG(ch) (debug_flags & (1 << ((ch) & 31)))
extern unsigned int debug_flags;
+RECHEADER *allocrec(RECHEADER *, size_t);
void append(RECHEADER **, int, FILE *, void (*)(const RECHEADER *, FILE *));
void concat(FILE *, FILE *);
length_t enterkey(RECHEADER *, const u_char *, u_char *, size_t, struct field *);