Sparse: fix "'merge_file' not declared" warning
RFC PATCH 7/10 Sparse: fix "'merge_file' not declared" warning
Add a declaration for merge_file() to a new "merge-file.h" header file, and add the appropriate include directives.
Signed-off-by Ramsay Jones <[email protected]>
---
There are two other (static) definitions of a merge_file() function, one in merge-recursive.c, which could probably be renamed merge_filespec() and one in merge-index.c, which could be renamed merge_path(). Maybe the the function in merge-file.c should be called merge_blob() ... (and then change the file names too!)
Makefile | 3 ++- merge-file.c | 1 + merge-file.h | 8 ++++++++ merge-tree.c | 3 +-- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 merge-file.h
Makefile +2 -1
@@ -296,7 +296,8 @@ LIB_H = \ diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \ run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \ tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \ - utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h mailmap.h + utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \ + mailmap.h merge-file.h DIFF_OBJS = \ diff.o diff-lib.o diffcore-break.o diffcore-order.o \
merge-file.c +1 -0
@@ -2,6 +2,7 @@#include "run-command.h" #include "xdiff-interface.h" #include "blob.h" +#include "merge-file.h" static int fill_mmfile_blob (mmfile_t *f,struct blob *obj) {
merge-file.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef MERGE_FILE_H +#define MERGE_FILE_H + +#include "blob.h" + +extern void *merge_file (struct blob *,struct blob *,struct blob *,unsigned long *); + +#endif
merge-tree.c +1 -2
@@ -2,6 +2,7 @@#include "tree-walk.h" #include "xdiff-interface.h" #include "blob.h" +#include "merge-file.h" static const char merge_tree_usage[] ="git-merge-tree <base-tree> <branch1> <branch2>" ;static int resolve_directories =1 ;
@@ -53,8 +54,6 @@ static const char *explanation(struct merge_list *entry)return "removed in remote" ; } -extern void *merge_file (struct blob *,struct blob *,struct blob *,unsigned long *); -static void *result (struct merge_list *entry,unsigned long *size) {enum object_type type;
Signature · 1 line
1.5.2