Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/sort makeline(): put back the memmove(3) removed in ...



details:   https://anonhg.NetBSD.org/src/rev/3a367982fdf9
branches:  trunk
changeset: 502208:3a367982fdf9
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Jan 13 20:10:52 2001 +0000

description:
makeline(): put back the memmove(3) removed in rev 1.5 in belief it's been
        redundant. "Oops"
This fixes bug reported to me by Simon Burge.

diffstat:

 usr.bin/sort/files.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r c753c6f877d3 -r 3a367982fdf9 usr.bin/sort/files.c
--- a/usr.bin/sort/files.c      Sat Jan 13 19:38:51 2001 +0000
+++ b/usr.bin/sort/files.c      Sat Jan 13 20:10:52 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: files.c,v 1.12 2001/01/13 17:27:21 itojun Exp $        */
+/*     $NetBSD: files.c,v 1.13 2001/01/13 20:10:52 jdolecek Exp $      */
 
 /*-
  * Copyright (c) 1993
@@ -40,7 +40,7 @@
 #include "fsort.h"
 
 #ifndef lint
-__RCSID("$NetBSD: files.c,v 1.12 2001/01/13 17:27:21 itojun Exp $");
+__RCSID("$NetBSD: files.c,v 1.13 2001/01/13 20:10:52 jdolecek Exp $");
 __SCCSID("@(#)files.c  8.1 (Berkeley) 6/6/93");
 #endif /* not lint */
 
@@ -133,7 +133,7 @@
        u_char *bufend;
        struct field *dummy2;
 {
-       static size_t olen;
+       static char *opos;
        char *pos;
        static int fileno = 0, overflow = 0;
        static FILE *fp = 0;
@@ -141,7 +141,8 @@
 
        pos = (char *) buffer->data;
        if (overflow) {
-               pos += olen;
+               memmove(pos, opos, bufend - (u_char *) opos);
+               pos += ((char *)bufend - opos);
                overflow = 0;
        }
        for (;;) {
@@ -164,8 +165,7 @@
                if (pos >= (char *)bufend) {
                        if (buffer->data < bufend) {
                                overflow = 1;
-                               olen = (size_t) (((char *) bufend) - 
-                                               ((char *) buffer->data));
+                               opos = (char *)buffer->data;
                        }
                        return (BUFFEND);
                } else if (c == EOF) {



Home | Main Index | Thread Index | Old Index