@@ -145,13 +145,15 @@ static int xdl_orig_copy(xdfenv_t *xe, int i, int count, int add_nl, char *dest)
145
145
static int fill_conflict_hunk (xdfenv_t * xe1 , const char * name1 ,
146
146
xdfenv_t * xe2 , const char * name2 ,
147
147
int size , int i , int style ,
148
- xdmerge_t * m , char * dest )
148
+ xdmerge_t * m , char * dest , int marker_size )
149
149
{
150
- const int marker_size = 7 ;
151
150
int marker1_size = (name1 ? strlen (name1 ) + 1 : 0 );
152
151
int marker2_size = (name2 ? strlen (name2 ) + 1 : 0 );
153
152
int j ;
154
153
154
+ if (marker_size <= 0 )
155
+ marker_size = DEFAULT_CONFLICT_MARKER_SIZE ;
156
+
155
157
/* Before conflicting part */
156
158
size += xdl_recs_copy (xe1 , i , m -> i1 - i , 0 ,
157
159
dest ? dest + size : NULL );
@@ -214,14 +216,16 @@ static int fill_conflict_hunk(xdfenv_t *xe1, const char *name1,
214
216
215
217
static int xdl_fill_merge_buffer (xdfenv_t * xe1 , const char * name1 ,
216
218
xdfenv_t * xe2 , const char * name2 ,
217
- xdmerge_t * m , char * dest , int style )
219
+ xdmerge_t * m , char * dest , int style ,
220
+ int marker_size )
218
221
{
219
222
int size , i ;
220
223
221
224
for (size = i = 0 ; m ; m = m -> next ) {
222
225
if (m -> mode == 0 )
223
226
size = fill_conflict_hunk (xe1 , name1 , xe2 , name2 ,
224
- size , i , style , m , dest );
227
+ size , i , style , m , dest ,
228
+ marker_size );
225
229
else if (m -> mode == 1 )
226
230
size += xdl_recs_copy (xe1 , i , m -> i1 + m -> chg1 - i , 0 ,
227
231
dest ? dest + size : NULL );
@@ -386,8 +390,9 @@ static int xdl_simplify_non_conflicts(xdfenv_t *xe1, xdmerge_t *m,
386
390
*/
387
391
static int xdl_do_merge (xdfenv_t * xe1 , xdchange_t * xscr1 , const char * name1 ,
388
392
xdfenv_t * xe2 , xdchange_t * xscr2 , const char * name2 ,
389
- int flags , xpparam_t const * xpp , mmbuffer_t * result ) {
393
+ int flags , xmparam_t const * xmp , mmbuffer_t * result ) {
390
394
xdmerge_t * changes , * c ;
395
+ xpparam_t const * xpp = & xmp -> xpp ;
391
396
int i0 , i1 , i2 , chg0 , chg1 , chg2 ;
392
397
int level = flags & XDL_MERGE_LEVEL_MASK ;
393
398
int style = flags & XDL_MERGE_STYLE_MASK ;
@@ -522,16 +527,18 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,
522
527
}
523
528
/* output */
524
529
if (result ) {
530
+ int marker_size = xmp -> marker_size ;
525
531
int size = xdl_fill_merge_buffer (xe1 , name1 , xe2 , name2 ,
526
- changes , NULL , style );
532
+ changes , NULL , style ,
533
+ marker_size );
527
534
result -> ptr = xdl_malloc (size );
528
535
if (!result -> ptr ) {
529
536
xdl_cleanup_merge (changes );
530
537
return -1 ;
531
538
}
532
539
result -> size = size ;
533
540
xdl_fill_merge_buffer (xe1 , name1 , xe2 , name2 , changes ,
534
- result -> ptr , style );
541
+ result -> ptr , style , marker_size );
535
542
}
536
543
return xdl_cleanup_merge (changes );
537
544
}
@@ -575,7 +582,7 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,
575
582
} else {
576
583
status = xdl_do_merge (& xe1 , xscr1 , name1 ,
577
584
& xe2 , xscr2 , name2 ,
578
- flags , xpp , result );
585
+ flags , xmp , result );
579
586
}
580
587
xdl_free_script (xscr1 );
581
588
xdl_free_script (xscr2 );
0 commit comments