Commit Diff


commit - 1afa8e435b1e169d19d571b0aab45bd36a3d5eff
commit + c48ceb4cb5c011dd474de08159b58efa8cb3c76e
blob - b98362f0febad04602f88995c59d4c2368ae1fb8
blob + bae648774b96b2a6c828b2cd39cf1e0f49154897
--- lib/diffreg.c
+++ lib/diffreg.c
@@ -881,15 +881,6 @@ output(FILE *outfile, struct got_diff_state *ds, struc
 		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, struc
 {
 	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, struc
 		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
 {
 	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");
blob - 653bd1114639fcc63b24e5fb1dbc37ace8cf40b2
blob + 9bc437536087d73860468218b8e87fa9bec585dd
--- lib/got_lib_diff.h
+++ 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];
 };