Bug 1330533 - Remove XRE_LibFuzzerGetFuncs. r=decoder
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 12 Jan 2017 16:02:50 +0900
changeset 375293 e685016e259743cdae7ce9f8c70a981b91e5955c
parent 375292 7fc26210eee598018ce3e926ce413118f19ccf1f
child 375294 41914acaabea2783036faac564f4f22faacf2952
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdecoder
bugs1330533
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1330533 - Remove XRE_LibFuzzerGetFuncs. r=decoder Now that XRE_LibFuzzerGetFuncs is not used from outside libxul, it can be inlined in LibFuzzerRunner::Run, simplifying things a little more.
tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
tools/fuzzing/libfuzzer/harness/LibFuzzerRunner.cpp
xpcom/build/nsXULAppAPI.h
--- a/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
+++ b/tools/fuzzing/libfuzzer/harness/LibFuzzerRegistry.cpp
@@ -1,22 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * * This Source Code Form is subject to the terms of the Mozilla Public
  * * License, v. 2.0. If a copy of the MPL was not distributed with this
  * * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "LibFuzzerRegistry.h"
 
-void XRE_LibFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc, LibFuzzerTestingFunc* testingFunc) {
-    std::string moduleNameStr(moduleName);
-    mozilla::LibFuzzerFunctions funcs = mozilla::LibFuzzerRegistry::getInstance().getModuleFunctions(moduleNameStr);
-    *initFunc = funcs.first;
-    *testingFunc = funcs.second;
-}
-
 namespace mozilla {
 
 LibFuzzerRegistry& LibFuzzerRegistry::getInstance() {
     static LibFuzzerRegistry instance;
     return instance;
 }
 
 void LibFuzzerRegistry::registerModule(std::string moduleName, LibFuzzerInitFunc initFunc, LibFuzzerTestingFunc testingFunc) {
--- a/tools/fuzzing/libfuzzer/harness/LibFuzzerRunner.cpp
+++ b/tools/fuzzing/libfuzzer/harness/LibFuzzerRunner.cpp
@@ -21,19 +21,20 @@ class _InitLibFuzzer {
 public:
   _InitLibFuzzer() {
     libFuzzerRunner = new LibFuzzerRunner();
   }
 } InitLibFuzzer;
 
 int LibFuzzerRunner::Run(int* argc, char*** argv) {
   ScopedXPCOM xpcom("LibFuzzer");
-  LibFuzzerInitFunc initFunc = nullptr;
-  LibFuzzerTestingFunc testingFunc = nullptr;
-  XRE_LibFuzzerGetFuncs(getenv("LIBFUZZER"), &initFunc, &testingFunc);
+  std::string moduleNameStr(getenv("LIBFUZZER"));
+  LibFuzzerFunctions funcs = LibFuzzerRegistry::getInstance().getModuleFunctions(moduleNameStr);
+  LibFuzzerInitFunc initFunc = funcs.first;
+  LibFuzzerTestingFunc testingFunc = funcs.second;
   if (initFunc) {
     int ret = initFunc(argc, argv);
     if (ret) {
       fprintf(stderr, "LibFuzzer: Error: Initialize callback failed\n");
       return ret;
     }
   }
 
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -512,14 +512,11 @@ XRE_API(void,
 
 
 #ifdef LIBFUZZER
 #include "LibFuzzerRegistry.h"
 
 XRE_API(void,
         XRE_LibFuzzerSetDriver, (LibFuzzerDriver))
 
-XRE_API(void,
-        XRE_LibFuzzerGetFuncs, (const char*, LibFuzzerInitFunc*,
-                                LibFuzzerTestingFunc*))
 #endif // LIBFUZZER
 
 #endif // _nsXULAppAPI_h__