This patch moves two inline functions from a header file to the corresponding c file. Otherwise forte12 refuses to compile git with the following error:
LINK git-convert-objects
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
(file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree.o) type=FUNC);
ld: fatal: symbol `tree_entry_extract' is multiply-defined:
(file libgit.a(sha1_name.o) type=FUNC; file libgit.a(tree-walk.o) type=FUNC);
ld: fatal: File processing errors. No output written to git-convert-objects
gmake[1]: *** [git-convert-objects] Error 1Signed-off-by: Thomas Glanzmann <sithglan@stud.uni-erlangen.de> --- tree-walk.c | 14 ++++++++++++++ tree-walk.h | 13 +------------ 2 files changed, 15 insertions(+), 12 deletions(-)
Show changes to 2 files +15 −12
tree-walk.c, tree-walk.h
diff --git a/tree-walk.c b/tree-walk.c index cbb24eb..ef57951 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -2,6 +2,20 @@ #include "tree-walk.h" #include "tree.h" +inline int tree_entry_len(const char *name, const unsigned char *sha1) +{ + return (char *)sha1 - (char *)name - 1; +} + +inline const unsigned char *tree_entry_extract(struct tree_desc *desc, + const char **pathp, unsigned int *modep) +{ + *pathp = desc->entry.path; + *modep = canon_mode(desc->entry.mode); + return desc->entry.sha1; +} + + static const char *get_mode(const char *str, unsigned int *modep) { unsigned char c; diff --git a/tree-walk.h b/tree-walk.h index 43458cf..984f19e 100644 --- a/tree-walk.h +++ b/tree-walk.h @@ -13,21 +13,10 @@ struct tree_desc { unsigned int size; }; -static inline const unsigned char *tree_entry_extract(struct tree_desc *desc, const char **pathp, unsigned int *modep) -{ - *pathp = desc->entry.path; - *modep = canon_mode(desc->entry.mode); - return desc->entry.sha1; -} - -static inline int tree_entry_len(const char *name, const unsigned char *sha1) -{ - return (char *)sha1 - (char *)name - 1; -} - void update_tree_entry(struct tree_desc *); void init_tree_desc(struct tree_desc *desc, const void *buf, unsigned long size); const unsigned char *tree_entry_extract(struct tree_desc *, const char **, unsigned int *); +int tree_entry_len(const char *name, const unsigned char *sha1); /* Helper function that does both of the above and returns true for success */ int tree_entry(struct tree_desc *, struct name_entry *);
-- 1.5.1.3