]> git.neil.brown.name Git - wiggle.git/commitdiff
vpatch: change prepare_merge to a macro for proper c
authorSean Farley <sean.michael.farley@gmail.com>
Tue, 8 Oct 2013 23:23:45 +0000 (07:23 +0800)
committerSean Farley <sean.michael.farley@gmail.com>
Wed, 9 Oct 2013 00:11:22 +0000 (08:11 +0800)
vpatch.c

index c965af1861ac3204fa1c45b884811c0c70590fd6..0a723a50ef21bc2b36043bb1df2f4cf864c03545 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -1392,23 +1392,23 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
                while (pos.p.lineno < ln && ci.merger[pos.p.m].type != End); \
        } while(0)
 
-       void prepare_merge(int ch)
-       {
-               /* FIXME check for errors in the stream */
-               fm = split_stream(sm, ByWord | ignore_blanks);
-               fb = split_stream(sb, ByWord | ignore_blanks);
-               fa = split_stream(sa, ByWord | ignore_blanks);
-
-               if (ch && !just_diff)
-                       csl1 = pdiff(fm, fb, ch);
-               else
-                       csl1 = diff(fm, fb);
-               csl2 = diff_patch(fb, fa);
-
-               ci = make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0);
-               for (i = 0; ci.merger[i].type != End; i++)
-                       ci.merger[i].oldtype = ci.merger[i].type;
-       }
+       #define prepare_merge(ch) \
+       do { \
+               /* FIXME check for errors in the stream */ \
+               fm = split_stream(sm, ByWord | ignore_blanks); \
+               fb = split_stream(sb, ByWord | ignore_blanks); \
+               fa = split_stream(sa, ByWord | ignore_blanks); \
+\
+               if (ch && !just_diff) \
+                       csl1 = pdiff(fm, fb, ch); \
+               else \
+                       csl1 = diff(fm, fb); \
+               csl2 = diff_patch(fb, fa); \
+\
+               ci = make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0); \
+               for (i = 0; ci.merger[i].type != End; i++) \
+                       ci.merger[i].oldtype = ci.merger[i].type; \
+       } while(0)
 
        if (selftest) {
                intr_kills = 1;