remove REVERSE and NREVERSE diff output options from diffreg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
diff --git a/lib/diffreg.c b/lib/diffreg.c
index d0647fd..b98362f 100644
--- a/lib/diffreg.c
+++ b/lib/diffreg.c
@@ -186,7 +186,6 @@ struct context_vec {
static void diff_output(FILE *, const char *, ...);
static int output(FILE *, struct got_diff_state *, struct got_diff_args *, const char *, FILE *, const char *, FILE *, int);
static void check(struct got_diff_state *, FILE *, FILE *, int);
-static void range(FILE *, int, int, char *);
static void uni_range(FILE *, int, int);
static void dump_unified_vec(FILE *, struct got_diff_state *, struct got_diff_args *, FILE *, FILE *, int);
static int prepare(struct got_diff_state *, int, FILE *, off_t, int);
@@ -898,14 +897,6 @@ output(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
}
static void
-range(FILE *outfile, int a, int b, char *separator)
-{
- diff_output(outfile, "%d", a > b ? b : a);
- if (a < b)
- diff_output(outfile, "%s%d", separator, b);
-}
-
-static void
uni_range(FILE *outfile, int a, int b)
{
if (a < b)
@@ -981,30 +972,11 @@ change(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
}
if (ds->anychange == 0)
ds->anychange = 1;
- switch (args->diff_format) {
- case D_BRIEF:
+ if (args->diff_format == D_BRIEF)
return (0);
- case D_REVERSE:
- diff_output(outfile, "%c", a > b ? 'a' : c > d ? 'd' : 'c');
- range(outfile, a, b, " ");
- diff_output(outfile, "\n");
- break;
- case D_NREVERSE:
- if (a > b)
- diff_output(outfile, "a%d %d\n", b, d - c + 1);
- else {
- diff_output(outfile, "d%d %d\n", a, b - a + 1);
- if (!(c > d))
- /* add changed lines */
- diff_output(outfile, "a%d %d\n", b, d - c + 1);
- }
- break;
- }
if (args->diff_format == D_IFDEF)
fetch(outfile, ds, args, ds->ixold, a, b, f1, '<', 1, *pflags);
i = fetch(outfile, ds, args, ds->ixnew, c, d, f2, '\0', 0, *pflags);
- if (args->diff_format == D_REVERSE && c <= d)
- diff_output(outfile, ".\n");
if (ds->inifdef) {
diff_output(outfile, "#endif /* %s */\n", args->ifdefname);
ds->inifdef = 0;
@@ -1057,12 +1029,8 @@ fetch(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
col = 0;
for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) {
if ((c = getc(lb)) == EOF) {
- if (args->diff_format == D_REVERSE ||
- args->diff_format == D_NREVERSE)
- warnx("No newline at end of file");
- else
- diff_output(outfile, "\n\\ No newline at end of "
- "file\n");
+ diff_output(outfile, "\n\\ No newline at end of "
+ "file\n");
return (0);
}
if (c == '\t' && (flags & D_EXPANDTABS)) {
diff --git a/lib/got_lib_diff.h b/lib/got_lib_diff.h
index 755a962..653bd11 100644
--- a/lib/got_lib_diff.h
+++ b/lib/got_lib_diff.h
@@ -37,11 +37,8 @@
/*
* Output format options
*/
-#define D_REVERSE 1 /* Reverse editor script */
#define D_UNIFIED 3 /* Unified context diff */
#define D_IFDEF 4 /* Diff with merged #ifdef's */
-#define D_NREVERSE 5 /* Reverse ed script with numbered
- lines and no trailing . */
#define D_BRIEF 6 /* Say if the files differ */
/*