Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/diffbreaker Exclude lines that are not part of t...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8746e8d822c3
branches:  trunk
changeset: 434490:8746e8d822c3
user:      nat <nat%pkgsrc.org@localhost>
date:      Wed Jun 17 11:45:08 2020 +0000

description:
Exclude lines that are not part of the diff better.
Simplify file read function.

Bump diffbreaker version.

diffstat:

 devel/diffbreaker/Makefile                        |   4 ++--
 devel/diffbreaker/files/diffbreaker/diffbreaker.c |  15 +++++----------
 2 files changed, 7 insertions(+), 12 deletions(-)

diffs (55 lines):

diff -r c332df07d457 -r 8746e8d822c3 devel/diffbreaker/Makefile
--- a/devel/diffbreaker/Makefile        Wed Jun 17 11:06:58 2020 +0000
+++ b/devel/diffbreaker/Makefile        Wed Jun 17 11:45:08 2020 +0000
@@ -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 -r c332df07d457 -r 8746e8d822c3 devel/diffbreaker/files/diffbreaker/diffbreaker.c
--- a/devel/diffbreaker/files/diffbreaker/diffbreaker.c Wed Jun 17 11:06:58 2020 +0000
+++ b/devel/diffbreaker/files/diffbreaker/diffbreaker.c Wed Jun 17 11:45:08 2020 +0000
@@ -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@localhost>
@@ -439,20 +439,12 @@
        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 @@
                                action[j] = myaction;
                                if (action[j] != 4)
                                        j++;
+                               else {
+                                       memset(ORIGBUF(j), 0, (size_t)cpl);
+                                       action[j] = 0;
+                               }
                                n = 0;
-                               l = 0;
                        }
                }
        }



Home | Main Index | Thread Index | Old Index