summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2018-11-02 02:40:13 -0400
committerJunio C Hamano <gitster@pobox.com>2018-11-05 13:14:35 +0900
commit5eade0746e1daf659a9559d804068f9f31614625 (patch)
treeb82842386fcfd001c7bd89a972af6d0da42f1b39 /xdiff-interface.c
parentd2eb80935a4e93cd775b5e8dc3f07fa1cd21d330 (diff)
downloadgit-5eade0746e1daf659a9559d804068f9f31614625.tar.gz
xdiff-interface: drop parse_hunk_header()
This function was used only for parsing the hunk headers generated by xdiff. Now that we can use hunk callbacks to get that information directly, it has outlived its usefulness. Note to anyone who wants to resurrect it: the "len" parameter was totally unused, meaning that the function could read past the end of the "line" array. In practice this never happened, because we only used it to parse xdiff's generated header lines. But it would be dangerous to use it for other cases without fixing this defect. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index a23adb3c45..de9c524d2f 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -15,51 +15,6 @@ struct xdiff_emit_state {
struct strbuf remainder;
};
-static int parse_num(char **cp_p, int *num_p)
-{
- char *cp = *cp_p;
- int num = 0;
-
- while ('0' <= *cp && *cp <= '9')
- num = num * 10 + *cp++ - '0';
- if (!(cp - *cp_p))
- return -1;
- *cp_p = cp;
- *num_p = num;
- return 0;
-}
-
-int parse_hunk_header(char *line, int len,
- int *ob, int *on,
- int *nb, int *nn)
-{
- char *cp;
- cp = line + 4;
- if (parse_num(&cp, ob)) {
- bad_line:
- return error("malformed diff output: %s", line);
- }
- if (*cp == ',') {
- cp++;
- if (parse_num(&cp, on))
- goto bad_line;
- }
- else
- *on = 1;
- if (*cp++ != ' ' || *cp++ != '+')
- goto bad_line;
- if (parse_num(&cp, nb))
- goto bad_line;
- if (*cp == ',') {
- cp++;
- if (parse_num(&cp, nn))
- goto bad_line;
- }
- else
- *nn = 1;
- return -!!memcmp(cp, " @@", 3);
-}
-
static int xdiff_out_hunk(void *priv_,
long old_begin, long old_nr,
long new_begin, long new_nr,