Remove SingletonVault C bindings
authorYedidya Feldblum <yfeldblum@fb.com>
Tue, 2 Jan 2018 03:08:45 +0000 (19:08 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 2 Jan 2018 03:21:57 +0000 (19:21 -0800)
Summary: [Folly] Remove `SingletonVault` C bindings. They are not generally needed.

Reviewed By: spalamarchuk

Differential Revision: D6632104

fbshipit-source-id: 3aecb35277bc76a2171487404d6994a5ea296afc

folly/SingletonVault_c.cpp [deleted file]
folly/SingletonVault_c.h [deleted file]
folly/test/SingletonVaultCTest.cpp [deleted file]

diff --git a/folly/SingletonVault_c.cpp b/folly/SingletonVault_c.cpp
deleted file mode 100644 (file)
index f14173b..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2017 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <folly/SingletonVault_c.h>
-#include <folly/Singleton.h>
-
-extern "C" {
-
-SingletonVault_t *SingletonVault_singleton() {
-  return folly::SingletonVault::singleton();
-}
-
-void SingletonVault_registrationComplete(SingletonVault_t *vault) {
-  ((folly::SingletonVault*) vault)->registrationComplete();
-}
-
-void SingletonVault_destroyInstances(SingletonVault_t *vault) {
-  ((folly::SingletonVault*) vault)->destroyInstances();
-}
-
-void SingletonVault_reenableInstances(SingletonVault_t *vault) {
-  ((folly::SingletonVault*) vault)->reenableInstances();
-}
-
-} // extern "C"
diff --git a/folly/SingletonVault_c.h b/folly/SingletonVault_c.h
deleted file mode 100644 (file)
index eb67192..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2017 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// Plain C interface to SingletonVault. This facilitates combining programs
-// that cannot use C++ (e.g. programs written in C) with libraries that use
-// Singleton, by allowing the program to perform the required SingletonVault
-// lifecycle calls.
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void SingletonVault_t;
-
-SingletonVault_t *SingletonVault_singleton();
-void SingletonVault_registrationComplete(SingletonVault_t *vault);
-void SingletonVault_destroyInstances(SingletonVault_t *vault);
-void SingletonVault_reenableInstances(SingletonVault_t *vault);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
diff --git a/folly/test/SingletonVaultCTest.cpp b/folly/test/SingletonVaultCTest.cpp
deleted file mode 100644 (file)
index 7d48b88..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2017 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <folly/Singleton.h>
-#include <folly/SingletonVault_c.h>
-
-#include <folly/portability/GTest.h>
-
-FOLLY_TLS long instance_counter_instances = 0;
-
-class InstanceCounter {
- public:
-  InstanceCounter() {
-    instance_counter_instances++;
-  }
-
-  ~InstanceCounter() {
-    instance_counter_instances--;
-  }
-};
-
-TEST(SingletonVault, singletonReturnsSingletonInstance) {
-  SingletonVault_t *c = SingletonVault_singleton();
-  auto *cpp = folly::SingletonVault::singleton();
-  EXPECT_EQ(c, cpp);
-}
-
-struct TestTag {};
-template <typename T, typename Tag = folly::detail::DefaultTag>
-using SingletonTest = folly::Singleton <T, Tag, TestTag>;
-
-TEST(SingletonVault, singletonsAreCreatedAndDestroyed) {
-  auto vault = folly::SingletonVault::singleton<TestTag>();
-  SingletonTest<InstanceCounter> counter_singleton;
-  SingletonVault_registrationComplete((SingletonVault_t*) vault);
-  SingletonTest<InstanceCounter>::try_get();
-  EXPECT_EQ(instance_counter_instances, 1);
-  SingletonVault_destroyInstances((SingletonVault_t*) vault);
-  EXPECT_EQ(instance_counter_instances, 0);
-}