diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-02-26 13:37:15 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-26 13:37:15 -0800 |
commit | 3ed26a44b3415f5761bdab21f823d964c20a2824 (patch) | |
tree | 332fe9b5ccddbdec65ab482e7d1100c57355f253 /diff.h | |
parent | 18b26b18c50637eaa8fb1ae5f42fd94c8ac99507 (diff) | |
parent | a64e6a44c63a965c5bc26242ddd3ed049b42e117 (diff) | |
download | git-3ed26a44b3415f5761bdab21f823d964c20a2824.tar.gz |
Merge branch 'jk/more-comments-on-textconv'
The memory ownership rule of fill_textconv() API, which was a bit
tricky, has been documented a bit better.
* jk/more-comments-on-textconv:
diff: clarify textconv interface
Diffstat (limited to 'diff.h')
-rw-r--r-- | diff.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -349,10 +349,26 @@ extern void diff_no_index(struct rev_info *, int, const char **); extern int index_differs_from(const char *def, int diff_flags); +/* + * Fill the contents of the filespec "df", respecting any textconv defined by + * its userdiff driver. The "driver" parameter must come from a + * previous call to get_textconv(), and therefore should either be NULL or have + * textconv enabled. + * + * Note that the memory ownership of the resulting buffer depends on whether + * the driver field is NULL. If it is, then the memory belongs to the filespec + * struct. If it is non-NULL, then "outbuf" points to a newly allocated buffer + * that should be freed by the caller. + */ extern size_t fill_textconv(struct userdiff_driver *driver, struct diff_filespec *df, char **outbuf); +/* + * Look up the userdiff driver for the given filespec, and return it if + * and only if it has textconv enabled (otherwise return NULL). The result + * can be passed to fill_textconv(). + */ extern struct userdiff_driver *get_textconv(struct diff_filespec *one); extern int parse_rename_score(const char **cp_p); |