]> git.neil.brown.name Git - wiggle.git/commitdiff
Avoid use of "?:"
authorNeilBrown <neilb@suse.de>
Sat, 3 Aug 2019 01:47:43 +0000 (11:47 +1000)
committerNeilBrown <neilb@suse.de>
Sat, 3 Aug 2019 01:47:43 +0000 (11:47 +1000)
Some compilers (gcc with -pedantic) don't like the ?:
construct.  So give an explicit middle term.

Reported-by: Jari Aalto <jari.aalto@cante.net
Signed-off-by: NeilBrown <neilb@suse.de>
parse.c
vpatch.c

diff --git a/parse.c b/parse.c
index 897d0f07ec5e227b2dd43d9b42a3238121ba6500..3ef864911bac27f3517b7aa3eae72f5e822afa3a 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -296,7 +296,7 @@ struct plist *parse_patch(FILE *f, FILE *of, int *np)
                        if (of)
                                fputc(c, of);
 
-               start = ftell(of ?: f);
+               start = ftell(of ? of : f);
 
                if (c == EOF)
                        break;
@@ -312,7 +312,7 @@ struct plist *parse_patch(FILE *f, FILE *of, int *np)
                        else
                                pos = target2;
                }
-               end = ftell(of ?: f);
+               end = ftell(of ? of : f);
                if (pos > target2)
                        end -= (pos - target2) - 1;
                plist = patch_add_file(plist, np,
index b735f36178f74bf0a646435e9ec35e9d0f0d79da..2b9bd2986791f018fff478c4a237bedc1a064aee 100644 (file)
--- a/vpatch.c
+++ b/vpatch.c
@@ -1790,7 +1790,7 @@ static int merge_window(struct plist *p, FILE *f, int reverse, int replace,
                                        ci.merger, 0, &p->wiggles);
                                p->chunks = p->conflicts;
                                save_merge(fm, fb, fa, ci.merger,
-                                          p->outfile ?: p->file,
+                                          p->outfile ? p->outfile : p->file,
                                           p->outfile ? 0 : !p->is_merge);
                        }
                        if (!just_diff)