From 351535d3489f4583a49891726616375e249ab1f3 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Wed, 9 Oct 2013 07:23:45 +0800 Subject: [PATCH] vpatch: change prepare_merge to a macro for proper c --- vpatch.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/vpatch.c b/vpatch.c index c965af1..0a723a5 100644 --- 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; -- 2.39.5