remove support for the ifdef diff format 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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
diff --git a/lib/diffreg.c b/lib/diffreg.c
index b98362f..bae6487 100644
--- a/lib/diffreg.c
+++ b/lib/diffreg.c
@@ -881,15 +881,6 @@ output(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
if (error)
return (error);
}
- if (args->diff_format == D_IFDEF) {
- for (;;) {
-#define c i0
- if ((c = getc(f1)) == EOF)
- return (0);
- diff_output(outfile, "%c", c);
- }
-#undef c
- }
if (ds->anychange != 0)
dump_unified_vec(outfile, ds, args, f1, f2, flags);
@@ -921,7 +912,7 @@ change(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
{
int i;
- if (args->diff_format != D_IFDEF && a > b && c > d)
+ if (a > b && c > d)
return (0);
if (*pflags & D_HEADER) {
@@ -974,14 +965,7 @@ change(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
ds->anychange = 1;
if (args->diff_format == D_BRIEF)
return (0);
- 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 (ds->inifdef) {
- diff_output(outfile, "#endif /* %s */\n", args->ifdefname);
- ds->inifdef = 0;
- }
-
return (0);
}
@@ -991,35 +975,12 @@ fetch(FILE *outfile, struct got_diff_state *ds, struct got_diff_args *args,
{
int i, j, c, lastc, col, nc;
- /*
- * When doing #ifdef's, copy down to current line
- * if this is the first file, so that stuff makes it to output.
- */
- if (args->diff_format == D_IFDEF && oldfile) {
- long curpos = ftell(lb);
- /* print through if append (a>b), else to (nb: 0 vs 1 orig) */
- nc = f[a > b ? b : a - 1] - curpos;
- for (i = 0; i < nc; i++)
- diff_output(outfile, "%c", getc(lb));
- }
if (a > b)
return (0);
- if (args->diff_format == D_IFDEF) {
- if (ds->inifdef) {
- diff_output(outfile, "#else /* %s%s */\n",
- oldfile == 1 ? "!" : "", args->ifdefname);
- } else {
- if (oldfile)
- diff_output(outfile, "#ifndef %s\n", args->ifdefname);
- else
- diff_output(outfile, "#ifdef %s\n", args->ifdefname);
- }
- ds->inifdef = 1 + oldfile;
- }
for (i = a; i <= b; i++) {
fseek(lb, f[i - 1], SEEK_SET);
nc = f[i] - f[i - 1];
- if (args->diff_format != D_IFDEF && ch != '\0') {
+ if (ch != '\0') {
diff_output(outfile, "%c", ch);
if (args->Tflag && args->diff_format == D_UNIFIED)
diff_output(outfile, "\t");
diff --git a/lib/got_lib_diff.h b/lib/got_lib_diff.h
index 653bd11..9bc4375 100644
--- a/lib/got_lib_diff.h
+++ b/lib/got_lib_diff.h
@@ -38,7 +38,6 @@
* Output format options
*/
#define D_UNIFIED 3 /* Unified context diff */
-#define D_IFDEF 4 /* Diff with merged #ifdef's */
#define D_BRIEF 6 /* Say if the files differ */
/*
@@ -81,7 +80,6 @@ struct got_diff_state {
int *klist; /* will be overlaid on file[0] after class */
int *member; /* will be overlaid on file[1] */
int clen;
- int inifdef; /* whether or not we are in a #ifdef block */
int len[2];
int pref, suff; /* length of prefix and suffix */
int slen[2];
@@ -107,7 +105,7 @@ struct got_diff_state {
struct got_diff_args {
int Tflag;
int diff_format, diff_context, status;
- char *ifdefname, *diffargs;
+ char *diffargs;
const char *label[2];
};