diff options
Diffstat (limited to 'editors')
-rw-r--r-- | editors/diff.c | 9 | ||||
-rw-r--r-- | editors/patch.c | 3 |
2 files changed, 6 insertions, 6 deletions
diff --git a/editors/diff.c b/editors/diff.c index 91109821e..2e3a455f7 100644 --- a/editors/diff.c +++ b/editors/diff.c | |||
@@ -432,7 +432,8 @@ static NOINLINE int *create_J(FILE_and_pos_t ft[2], int nlen[2], off_t *ix[2]) | |||
432 | token_t tok; | 432 | token_t tok; |
433 | size_t sz = 100; | 433 | size_t sz = 100; |
434 | nfile[i] = xmalloc((sz + 3) * sizeof(nfile[i][0])); | 434 | nfile[i] = xmalloc((sz + 3) * sizeof(nfile[i][0])); |
435 | fseeko(ft[i].ft_fp, 0, SEEK_SET); /* ft gets here without the correct position */ | 435 | /* ft gets here without the correct position, cant use seek_ft */ |
436 | fseeko(ft[i].ft_fp, 0, SEEK_SET); | ||
436 | 437 | ||
437 | nlen[i] = 0; | 438 | nlen[i] = 0; |
438 | /* We could zalloc nfile, but then zalloc starts showing in gprof at ~1% */ | 439 | /* We could zalloc nfile, but then zalloc starts showing in gprof at ~1% */ |
@@ -625,7 +626,7 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
625 | } | 626 | } |
626 | if (idx < 0) | 627 | if (idx < 0) |
627 | continue; | 628 | continue; |
628 | if (!(option_mask32 & FLAG(q)) && !((option_mask32 & FLAG(B)) && !nonempty)) { | 629 | if (!(option_mask32 & (FLAG(q)+FLAG(B))) && !nonempty) { |
629 | struct context_vec *cvp = vec; | 630 | struct context_vec *cvp = vec; |
630 | int lowa = MAX(1, cvp->a - opt_U_context); | 631 | int lowa = MAX(1, cvp->a - opt_U_context); |
631 | int upb = MIN(nlen[0], vec[idx].b + opt_U_context); | 632 | int upb = MIN(nlen[0], vec[idx].b + opt_U_context); |
@@ -634,8 +635,8 @@ static bool diff(FILE* fp[2], char *file[2]) | |||
634 | 635 | ||
635 | if (!anychange) { | 636 | if (!anychange) { |
636 | /* Print the context/unidiff header first time through */ | 637 | /* Print the context/unidiff header first time through */ |
637 | printf("--- %s\n", label[0] ?: file[0]); | 638 | printf("--- %s\n", label[0] ? label[0] : file[0]); |
638 | printf("+++ %s\n", label[1] ?: file[1]); | 639 | printf("+++ %s\n", label[1] ? label[1] : file[1]); |
639 | } | 640 | } |
640 | 641 | ||
641 | printf("@@ -"); | 642 | printf("@@ -"); |
diff --git a/editors/patch.c b/editors/patch.c index ab3af3ce7..b36980fed 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -85,7 +85,6 @@ int patch_main(int argc UNUSED_PARAM, char **argv) | |||
85 | { | 85 | { |
86 | const char *p = "-1"; | 86 | const char *p = "-1"; |
87 | const char *i = "-"; /* compat */ | 87 | const char *i = "-"; /* compat */ |
88 | const char *g; /* unimplemented, default is "0" */ | ||
89 | #if ENABLE_LONG_OPTS | 88 | #if ENABLE_LONG_OPTS |
90 | static const char patch_longopts[] ALIGN1 = | 89 | static const char patch_longopts[] ALIGN1 = |
91 | "strip\0" Required_argument "p" | 90 | "strip\0" Required_argument "p" |
@@ -97,7 +96,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) | |||
97 | ; | 96 | ; |
98 | applet_long_options = patch_longopts; | 97 | applet_long_options = patch_longopts; |
99 | #endif | 98 | #endif |
100 | opt = getopt32(argv, "p:i:RNg:", &p, &i, &g); | 99 | opt = getopt32(argv, "p:i:RNg:", &p, &i, NULL); |
101 | if (opt & OPT_R) | 100 | if (opt & OPT_R) |
102 | plus = '-'; | 101 | plus = '-'; |
103 | patch_level = xatoi(p); /* can be negative! */ | 102 | patch_level = xatoi(p); /* can be negative! */ |