René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes: > Could we move more code into the library code to avoid that ugliness? > > AFAICS, compare_buffer() builds a struct patch with an array of > struct chunks, whose members are then fed one by one into either > blame_chunk() or handle_split(). Could we avoid the allocation > altogether by using a different interface? > > E.g. have a callback like this: > > static void handle_split_cb(long same, long p_next, long t_next, > void *data) > { > struct chunk_cb_data *d = data; > handle_split(d->sb, d->ent, d->tlno, d->plno, same, > d->parent, d->split); > d->plno = p_next; > d->tlno = t_next; > } > > And use it like this: > > struct chunk_cb_data d = {sb, ent, 0, 0, parent, split}; > xpparam_t xpp; > xdemitconf_t xecfg; > > xpp.flags = xdl_opts; > memset(&xecfg, 0, sizeof(xecfg)); > xecfg.ctxlen = context; > xdi_diff_chunks(file_p, file_o, &xpp, &xecfg, handle_split_cb, &d); > handle_split(sb, ent, d.tlno, d.plno, ent->num_lines, > parent, split); > > Makes sense? Absolutely; very well formulated. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html