fuzzers: declare standalone functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
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