mb[2].size = strlen(mb[2].ptr);
i++;
}
- if (ecb->outf(ecb->priv, mb, i) < 0) {
+ if (ecb->out_line(ecb->priv, mb, i) < 0) {
return -1;
}
return str - out;
}
-int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
- const char *func, long funclen, xdemitcb_t *ecb) {
+static int xdl_format_hunk_hdr(long s1, long c1, long s2, long c2,
+ const char *func, long funclen,
+ xdemitcb_t *ecb) {
int nb = 0;
mmbuffer_t mb;
char buf[128];
mb.ptr = buf;
mb.size = nb;
- if (ecb->outf(ecb->priv, &mb, 1) < 0)
+ if (ecb->out_line(ecb->priv, &mb, 1) < 0)
return -1;
+ return 0;
+}
+int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,
+ const char *func, long funclen,
+ xdemitcb_t *ecb) {
+ if (!ecb->out_hunk)
+ return xdl_format_hunk_hdr(s1, c1, s2, c2, func, funclen, ecb);
+ if (ecb->out_hunk(ecb->priv,
+ c1 ? s1 : s1 - 1, c1,
+ c2 ? s2 : s2 - 1, c2,
+ func, funclen) < 0)
+ return -1;
return 0;
}