Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/diffbreaker/files/diffbreaker Use secondary buff...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/54f756577a6c
branches:  trunk
changeset: 434531:54f756577a6c
user:      nat <nat%pkgsrc.org@localhost>
date:      Thu Jun 18 13:38:49 2020 +0000

description:
Use secondary buffer as an intermediatory to fix compilation with SSP_FORTIFY.

diffstat:

 devel/diffbreaker/files/diffbreaker/diffbreaker.c |  20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diffs (61 lines):

diff -r 15a7d851afaa -r 54f756577a6c devel/diffbreaker/files/diffbreaker/diffbreaker.c
--- a/devel/diffbreaker/files/diffbreaker/diffbreaker.c Thu Jun 18 13:38:45 2020 +0000
+++ b/devel/diffbreaker/files/diffbreaker/diffbreaker.c Thu Jun 18 13:38:49 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: diffbreaker.c,v 1.6 2020/06/18 00:00:25 nat Exp $ */
+/* $NetBSD: diffbreaker.c,v 1.7 2020/06/18 13:38:49 nat Exp $ */
 
 /*-
  * Copyright (c) 2018, 2019 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -101,9 +101,8 @@
                                continue;
                        }
                        if (*ORIGBUF(i) == '+') {
-                               if (j != i)
-                                       strncpy(ORIGBUF(j), ORIGBUF(i), len);
-                               *ORIGBUF(j) = ' ';
+                               strncpy(NEWBUF(j), ORIGBUF(i), len);
+                               *NEWBUF(j) = ' ';
                                action[j] = 0;
                        }
                        break;
@@ -114,8 +113,7 @@
                        pending = false;
                        writesect = false;
                        action[j] = action[i];
-                       if (j != i)
-                               strncpy(ORIGBUF(j), ORIGBUF(i), len);
+                       strncpy(NEWBUF(j), ORIGBUF(i), len);
                        break;
                case 6: /* --- */
                        if (pending == false && writesect == false)
@@ -126,13 +124,11 @@
                        pending = true;
                        writetome = false;
                        writesect = true;
-                       if (j != i)
-                               strncpy(ORIGBUF(j), ORIGBUF(i), len);
+                       strncpy(NEWBUF(j), ORIGBUF(i), len);
                        action[j] = action[i];
                        break;
                case 7: /* +++ */
-                       if (j != i)
-                               strncpy(ORIGBUF(j), ORIGBUF(i), len);
+                       strncpy(NEWBUF(j), ORIGBUF(i), len);
                        action[j] = action[i];
                        break;
                case 1: /* unselected change */
@@ -141,11 +137,11 @@
                        writetome = true;
                        /* fallthrough */
                default:
-                       if (j != i)
-                               strncpy(ORIGBUF(j), ORIGBUF(i), len);
+                       strncpy(NEWBUF(j), ORIGBUF(i), len);
                        action[j] = action[i];
                        break;
                }
+               strncpy(ORIGBUF(j), NEWBUF(j), len);
                j++;
        }
        totalLines = display ? j-- : 0;



Home | Main Index | Thread Index | Old Index