Commit 489aec44477181afa05db41bfd04bb0febe83f59

Edward Thomson 2021-11-11T12:33:14

fuzzers: declare standalone functions

diff --git a/fuzzers/commit_graph_fuzzer.c b/fuzzers/commit_graph_fuzzer.c
index 05783a2..1c46d78 100644
--- a/fuzzers/commit_graph_fuzzer.c
+++ b/fuzzers/commit_graph_fuzzer.c
@@ -17,6 +17,8 @@
 #include "hash.h"
 #include "commit_graph.h"
 
+#include "standalone_driver.h"
+
 int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
 	GIT_UNUSED(argc);
diff --git a/fuzzers/config_file_fuzzer.c b/fuzzers/config_file_fuzzer.c
index 526c939..582d74a 100644
--- a/fuzzers/config_file_fuzzer.c
+++ b/fuzzers/config_file_fuzzer.c
@@ -10,6 +10,8 @@
 #include "git2.h"
 #include "config_backend.h"
 
+#include "standalone_driver.h"
+
 #define UNUSED(x) (void)(x)
 
 int foreach_cb(const git_config_entry *entry, void *payload)
diff --git a/fuzzers/download_refs_fuzzer.c b/fuzzers/download_refs_fuzzer.c
index c5726cb..bdaa6aa 100644
--- a/fuzzers/download_refs_fuzzer.c
+++ b/fuzzers/download_refs_fuzzer.c
@@ -15,6 +15,8 @@
 #include "git2/sys/transport.h"
 #include "futils.h"
 
+#include "standalone_driver.h"
+
 #define UNUSED(x) (void)(x)
 
 struct fuzzer_buffer {
diff --git a/fuzzers/midx_fuzzer.c b/fuzzers/midx_fuzzer.c
index 3cd6090..4c3124e 100644
--- a/fuzzers/midx_fuzzer.c
+++ b/fuzzers/midx_fuzzer.c
@@ -16,6 +16,8 @@
 #include "hash.h"
 #include "midx.h"
 
+#include "standalone_driver.h"
+
 int LLVMFuzzerInitialize(int *argc, char ***argv)
 {
 	GIT_UNUSED(argc);
diff --git a/fuzzers/objects_fuzzer.c b/fuzzers/objects_fuzzer.c
index 1feff77..51b4a1e 100644
--- a/fuzzers/objects_fuzzer.c
+++ b/fuzzers/objects_fuzzer.c
@@ -10,6 +10,8 @@
 #include "git2.h"
 #include "object.h"
 
+#include "standalone_driver.h"
+
 #define UNUSED(x) (void)(x)
 
 int LLVMFuzzerInitialize(int *argc, char ***argv)
diff --git a/fuzzers/packfile_fuzzer.c b/fuzzers/packfile_fuzzer.c
index f739b95..8667cb9 100644
--- a/fuzzers/packfile_fuzzer.c
+++ b/fuzzers/packfile_fuzzer.c
@@ -14,6 +14,8 @@
 #include "common.h"
 #include "str.h"
 
+#include "standalone_driver.h"
+
 static git_odb *odb = NULL;
 static git_odb_backend *mempack = NULL;
 
diff --git a/fuzzers/patch_parse_fuzzer.c b/fuzzers/patch_parse_fuzzer.c
index a9b02ad..2e65a01 100644
--- a/fuzzers/patch_parse_fuzzer.c
+++ b/fuzzers/patch_parse_fuzzer.c
@@ -11,6 +11,8 @@
 #include "patch.h"
 #include "patch_parse.h"
 
+#include "standalone_driver.h"
+
 #define UNUSED(x) (void)(x)
 
 int LLVMFuzzerInitialize(int *argc, char ***argv)
diff --git a/fuzzers/standalone_driver.c b/fuzzers/standalone_driver.c
index c29102e..cd4f717 100644
--- a/fuzzers/standalone_driver.c
+++ b/fuzzers/standalone_driver.c
@@ -11,8 +11,7 @@
 #include "futils.h"
 #include "path.h"
 
-extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
-extern int LLVMFuzzerInitialize(int *argc, char ***argv);
+#include "standalone_driver.h"
 
 static int run_one_file(const char *filename)
 {
diff --git a/fuzzers/standalone_driver.h b/fuzzers/standalone_driver.h
new file mode 100644
index 0000000..507fcb9
--- /dev/null
+++ b/fuzzers/standalone_driver.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) the libgit2 contributors. All rights reserved.
+ *
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
+ * a Linking Exception. For full terms see the included COPYING file.
+ */
+
+#ifndef INCLUDE_standalone_driver_h__
+#define INCLUDE_standalone_driver_h__
+
+extern int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size);
+extern int LLVMFuzzerInitialize(int *argc, char ***argv);
+
+#endif