declare conflict marker strings in got_lib_diff.h
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
diff --git a/lib/diff3.c b/lib/diff3.c
index afc751f..a2506ec 100644
--- a/lib/diff3.c
+++ b/lib/diff3.c
@@ -423,11 +423,13 @@ diff3_internal(char *dp13, char *dp23, char *path1, char *path2, char *path3,
ssize_t m, n;
int i;
- i = snprintf(d3s->f1mark, sizeof(d3s->f1mark), "<<<<<<< %s", label1);
+ i = snprintf(d3s->f1mark, sizeof(d3s->f1mark),
+ "%s %s", GOT_DIFF_CONFLICT_MARKER_BEGIN, label1);
if (i < 0 || i >= (int)sizeof(d3s->f1mark))
return got_error(GOT_ERR_NO_SPACE);
- i = snprintf(d3s->f3mark, sizeof(d3s->f3mark), ">>>>>>> %s", label3);
+ i = snprintf(d3s->f3mark, sizeof(d3s->f3mark),
+ "%s %s", GOT_DIFF_CONFLICT_MARKER_END, label3);
if (i < 0 || i >= (int)sizeof(d3s->f3mark))
return got_error(GOT_ERR_NO_SPACE);
@@ -943,8 +945,8 @@ edscript(int n, struct diff3_state *d3s)
if (!d3s->oflag || !d3s->overlap[n])
prange(&d3s->de[n].old, d3s);
else
- diff_output(d3s->diffbuf, "%da\n=======\n",
- d3s->de[n].old.to -1);
+ diff_output(d3s->diffbuf, "%da\n%s\n",
+ d3s->de[n].old.to -1, GOT_DIFF_CONFLICT_MARKER_SEP);
(void)fseek(d3s->fp[2], (long)d3s->de[n].new.from, SEEK_SET);
k = d3s->de[n].new.to - d3s->de[n].new.from;
for (; k > 0; k-= j) {
diff --git a/lib/got_lib_diff.h b/lib/got_lib_diff.h
index 66906a1..b8fe79b 100644
--- a/lib/got_lib_diff.h
+++ b/lib/got_lib_diff.h
@@ -132,6 +132,10 @@ struct got_diff_args {
const char *label[2];
};
+#define GOT_DIFF_CONFLICT_MARKER_BEGIN "<<<<<<<"
+#define GOT_DIFF_CONFLICT_MARKER_SEP "======="
+#define GOT_DIFF_CONFLICT_MARKER_END ">>>>>>>"
+
const struct got_error *got_diffreg(int *, FILE *,
FILE *, int, struct got_diff_args *, struct got_diff_state *, FILE *,
struct got_diff_changes *);