{"thread":{"id":"30486","subject":"[PATCH] xdiff: remove unused functions","startedAt":"2012-05-09T20:43:30Z","lastAt":"2012-05-09T21:14:51Z","messageCount":2,"participants":["René Scharfe","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"191234","messageId":"4FAAD6F2.9050600@lsrfire.ath.cx","threadId":"30486","inReplyTo":null,"subject":"[PATCH] xdiff: remove unused functions","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2012-05-09T20:43:30Z","receivedAt":"2012-05-09T20:43:30Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"The functions xdl_cha_first(), xdl_cha_next() and xdl_atol() are not used\nby us.  While removing them increases the difference to the upstream\nversion of libxdiff, it only adds a bit to the more than 600 differing\nlines in xutils.c (mmfile_t management was simplified significantly when\nthe library was imported initially).  Besides, if upstream modifies these\nfunctions in the future, we won't need to think about importing those\nchanges, so in that sense it makes tracking modifications easier.\n\nSigned-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>\n---\n xdiff/xutils.c |   43 -------------------------------------------\n xdiff/xutils.h |    3 ---\n 2 files changed, 46 deletions(-)\n\ndiff --git a/xdiff/xutils.c b/xdiff/xutils.c\nindex 1b3b471..ae6ce0d 100644\n--- a/xdiff/xutils.c\n+++ b/xdiff/xutils.c\n@@ -122,35 +122,6 @@ void *xdl_cha_alloc(chastore_t *cha) {\n \treturn data;\n }\n \n-\n-void *xdl_cha_first(chastore_t *cha) {\n-\tchanode_t *sncur;\n-\n-\tif (!(cha->sncur = sncur = cha->head))\n-\t\treturn NULL;\n-\n-\tcha->scurr = 0;\n-\n-\treturn (char *) sncur + sizeof(chanode_t) + cha->scurr;\n-}\n-\n-\n-void *xdl_cha_next(chastore_t *cha) {\n-\tchanode_t *sncur;\n-\n-\tif (!(sncur = cha->sncur))\n-\t\treturn NULL;\n-\tcha->scurr += cha->isize;\n-\tif (cha->scurr == sncur->icurr) {\n-\t\tif (!(sncur = cha->sncur = sncur->next))\n-\t\t\treturn NULL;\n-\t\tcha->scurr = 0;\n-\t}\n-\n-\treturn (char *) sncur + sizeof(chanode_t) + cha->scurr;\n-}\n-\n-\n long xdl_guess_lines(mmfile_t *mf, long sample) {\n \tlong nl = 0, size, tsize = 0;\n \tchar const *data, *cur, *top;\n@@ -430,20 +401,6 @@ int xdl_num_out(char *out, long val) {\n \treturn str - out;\n }\n \n-\n-long xdl_atol(char const *str, char const **next) {\n-\tlong val, base;\n-\tchar const *top;\n-\n-\tfor (top = str; XDL_ISDIGIT(*top); top++);\n-\tif (next)\n-\t\t*next = top;\n-\tfor (val = 0, base = 1, top--; top >= str; top--, base *= 10)\n-\t\tval += base * (long)(*top - '0');\n-\treturn val;\n-}\n-\n-\n int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,\n \t\t      const char *func, long funclen, xdemitcb_t *ecb) {\n \tint nb = 0;\ndiff --git a/xdiff/xutils.h b/xdiff/xutils.h\nindex 714719a..ad1428e 100644\n--- a/xdiff/xutils.h\n+++ b/xdiff/xutils.h\n@@ -31,14 +31,11 @@ int xdl_emit_diffrec(char const *rec, long size, char const *pre, long psize,\n int xdl_cha_init(chastore_t *cha, long isize, long icount);\n void xdl_cha_free(chastore_t *cha);\n void *xdl_cha_alloc(chastore_t *cha);\n-void *xdl_cha_first(chastore_t *cha);\n-void *xdl_cha_next(chastore_t *cha);\n long xdl_guess_lines(mmfile_t *mf, long sample);\n int xdl_recmatch(const char *l1, long s1, const char *l2, long s2, long flags);\n unsigned long xdl_hash_record(char const **data, char const *top, long flags);\n unsigned int xdl_hashbits(unsigned int size);\n int xdl_num_out(char *out, long val);\n-long xdl_atol(char const *str, char const **next);\n int xdl_emit_hunk_hdr(long s1, long c1, long s2, long c2,\n \t\t      const char *func, long funclen, xdemitcb_t *ecb);\n int xdl_fall_back_diff(xdfenv_t *diff_env, xpparam_t const *xpp,\n-- \n1.7.10.1\n"},{"id":"191237","messageId":"7vipg5qcok.fsf@alter.siamese.dyndns.org","threadId":"30486","inReplyTo":"4FAAD6F2.9050600@lsrfire.ath.cx","subject":"Re: [PATCH] xdiff: remove unused functions","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-05-09T21:14:51Z","receivedAt":"2012-05-09T21:14:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:\n\n> The functions xdl_cha_first(), xdl_cha_next() and xdl_atol() are not used\n> by us.  While removing them increases the difference to the upstream\n> version of libxdiff, it only adds a bit to the more than 600 differing\n> lines in xutils.c (mmfile_t management was simplified significantly when\n> the library was imported initially).  Besides, if upstream modifies these\n> functions in the future, we won't need to think about importing those\n> changes, so in that sense it makes tracking modifications easier.\n\nI was of two minds wondering the exact pros-and-cons you described above,\nbut OK, let's shrink it.\n"}]}