diff options
author | nat <nat@pkgsrc.org> | 2020-06-17 11:45:08 +0000 |
---|---|---|
committer | nat <nat@pkgsrc.org> | 2020-06-17 11:45:08 +0000 |
commit | f2a36e2c6ee8d4cd0add98e1c94632c1432a5c2a (patch) | |
tree | a7c3f9b43922208ee998584bfd78ce1d4ea72691 /devel | |
parent | 52b1b2e4566ff0dd696f88aded6fd737c6d5a9a0 (diff) | |
download | pkgsrc-f2a36e2c6ee8d4cd0add98e1c94632c1432a5c2a.tar.gz |
Exclude lines that are not part of the diff better.
Simplify file read function.
Bump diffbreaker version.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/diffbreaker/Makefile | 4 | ||||
-rw-r--r-- | devel/diffbreaker/files/diffbreaker/diffbreaker.c | 15 |
2 files changed, 7 insertions, 12 deletions
diff --git a/devel/diffbreaker/Makefile b/devel/diffbreaker/Makefile index bcce2fa84c9..db8c55adbf6 100644 --- a/devel/diffbreaker/Makefile +++ b/devel/diffbreaker/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.2 2020/05/30 22:45:07 nat Exp $ +# $NetBSD: Makefile,v 1.3 2020/06/17 11:45:08 nat Exp $ -PKGNAME= diffbreaker-0.1 +PKGNAME= diffbreaker-0.2 #PKGREVISION= 1 CATEGORIES= devel diff --git a/devel/diffbreaker/files/diffbreaker/diffbreaker.c b/devel/diffbreaker/files/diffbreaker/diffbreaker.c index af6d3bb945f..3f6ec946e74 100644 --- a/devel/diffbreaker/files/diffbreaker/diffbreaker.c +++ b/devel/diffbreaker/files/diffbreaker/diffbreaker.c @@ -1,4 +1,4 @@ -/* $NetBSD: diffbreaker.c,v 1.2 2020/06/17 10:52:03 nat Exp $ */ +/* $NetBSD: diffbreaker.c,v 1.3 2020/06/17 11:45:08 nat Exp $ */ /*- * Copyright (c) 2018, 2019 Nathanial Sloss <nathanialsloss@yahoo.com.au> @@ -439,20 +439,12 @@ read_data_to_buffer(char *myFile) memset(buffer, 0, (size_t)totalalloc * sizeof(*buffer)); memset(newbuffer, 0, (size_t)totalalloc * sizeof(*newbuffer)); - l = 0; j = n = 0; lseek(fd, 0, SEEK_SET); while ((nr = read(fd, line, sizeof(line))) > 0) { for (i = 0; i < nr; i++) { data = line[i]; - l++; *(ORIGBUF(j) + n++) = data; - if (l == sizeof(line)) { - l = 0; - n = 0; - j++; - continue; - } if (data == '\n') { myaction = 0; if (*ORIGBUF(j) == '-' && *(ORIGBUF(j) + 1) == @@ -473,8 +465,11 @@ read_data_to_buffer(char *myFile) action[j] = myaction; if (action[j] != 4) j++; + else { + memset(ORIGBUF(j), 0, (size_t)cpl); + action[j] = 0; + } n = 0; - l = 0; } } } |