On 03-Sep-2017 23:04, Bram Moolenaar wrote:
Patch 8.0.1046
Problem:    Code duplication in diff mode.
Solution:   Use diff_equal_char() also in diff_cmp(). (Rick Howe)
Files:      src/diff.c


*** ../vim-8.0.1045/src/diff.c  2017-09-02 18:01:46.422018216 +0200
--- src/diff.c  2017-09-03 15:03:52.784327027 +0200
***************
*** 1661,1666 ****
--- 1661,1700 ----
   }
After this patch, HP-UX throws these errors is FEAT_MBYTE is not defined:
  cc -c -I. -Iproto -DHAVE_CONFIG_H  -O2   -o objects/diff.o diff.c
cc: "diff.c", line 1726: error 1588: "l" undefined.
cc: "diff.c", line 1726: warning 563: Argument #3 is not the correct type.
cc: "diff.c", line 1728: error 1603: Incompatible operands: assign operator. cc: "diff.c", line 1729: error 1603: Incompatible operands: assign operator.
cc: "diff.c", line 2039: error 1588: "l" undefined.
cc: "diff.c", line 2038: warning 563: Argument #3 is not the correct type.
cc: "diff.c", line 2041: error 1603: Incompatible operands: assign operator. cc: "diff.c", line 2042: error 1603: Incompatible operands: assign operator.
cc: "diff.c", line 2078: error 1588: "p1" undefined.
cc: "diff.c", line 2079: error 1588: "p2" undefined.
cc: "diff.c", line 2084: warning 563: Argument #1 is not the correct type.
cc: "diff.c", line 2084: warning 563: Argument #2 is not the correct type.
cc: "diff.c", line 2084: error 1588: "l" undefined.
cc: "diff.c", line 2084: warning 563: Argument #3 is not the correct type.
cc: "diff.c", line 2086: error 1603: Incompatible operands: assign operator. cc: "diff.c", line 2087: error 1603: Incompatible operands: assign operator.
*** Error exit code 1

Stop.

Please check the attached patch which tries to fix it.
Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
--- diff.c.orig 2017-09-05 05:38:04.268780800 +1000
+++ diff.c      2017-09-05 05:38:04.277789600 +1000
@@ -1702,9 +1702,6 @@
 diff_cmp(char_u *s1, char_u *s2)
 {
     char_u     *p1, *p2;
-#ifdef FEAT_MBYTE
-    int                l;
-#endif
 
     if ((diff_flags & (DIFF_ICASE | DIFF_IWHITE)) == 0)
        return STRCMP(s1, s2);
@@ -1723,6 +1720,7 @@
        }
        else
        {
+           int l;
            if (!diff_equal_char(p1, p2, &l))
                break;
            p1 += l;
@@ -1983,10 +1981,6 @@
     int                idx;
     int                off;
     int                added = TRUE;
-#ifdef FEAT_MBYTE
-    char_u     *p1, *p2;
-    int                l;
-#endif
 
     /* Make a copy of the line, the next ml_get() will invalidate it. */
     line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE));
@@ -2035,6 +2029,7 @@
                }
                else
                {
+                   int l;
                    if (!diff_equal_char(line_org + si_org, line_new + si_new,
                                                                           &l))
                        break;
@@ -2075,6 +2070,9 @@
                    }
                    else
                    {
+                       char_u *p1, *p2;
+                       int l;
+
                        p1 = line_org + ei_org;
                        p2 = line_new + ei_new;
 #ifdef FEAT_MBYTE

Raspunde prin e-mail lui