move `shellQuote` to implementation file v2016.09.19.00
authorDominik Gabi <dominik@fb.com>
Fri, 16 Sep 2016 22:00:45 +0000 (15:00 -0700)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Fri, 16 Sep 2016 22:08:34 +0000 (15:08 -0700)
Summary: Fixing ODR violations...

Reviewed By: simpkins, yfeldblum

Differential Revision: D3875667

fbshipit-source-id: 0d8ec0b48e14fffb7e3e60c0e68e2576b2f58d1e

folly/Makefile.am
folly/Shell.cpp [new file with mode: 0644]
folly/Shell.h

index 5a5f66abc694e7cdfe7aa5bd4b87ed0fa9906ea6..d1cdf4bd00d31f6968d3c3710f6e1ece0d1603d1 100644 (file)
@@ -468,6 +468,7 @@ libfolly_la_SOURCES = \
        Random.cpp \
        SafeAssert.cpp \
        SharedMutex.cpp \
+       Shell.cpp \
        MicroLock.cpp \
        Singleton.cpp \
        SocketAddress.cpp \
diff --git a/folly/Shell.cpp b/folly/Shell.cpp
new file mode 100644 (file)
index 0000000..f9c626b
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2016 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/Shell.h>
+
+namespace folly {
+
+std::string shellQuote(StringPiece argument) {
+  std::string quoted = "'";
+  for (auto c : argument) {
+    if (c == '\'') {
+      quoted += "'\\''";
+    } else {
+      quoted += c;
+    }
+  }
+  return quoted + "'";
+}
+
+} // folly
index c7aca9b79194fc78f6ca81eaa954d8e58e1b3c27..f7009c04f747d37f962aa06d2c18097e151ba47c 100644 (file)
@@ -27,6 +27,7 @@
 #include <string>
 #include <vector>
 
+#include <folly/Conv.h>
 #include <folly/Format.h>
 #include <folly/Range.h>
 
@@ -35,17 +36,7 @@ namespace folly {
 /**
  * Quotes an argument to make it suitable for use as shell command arguments.
  */
-std::string shellQuote(StringPiece argument) {
-  std::string quoted = "'";
-  for (auto c : argument) {
-    if (c == '\'') {
-      quoted += "'\\''";
-    } else {
-      quoted += c;
-    }
-  }
-  return quoted + "'";
-}
+std::string shellQuote(StringPiece argument);
 
 /**
   * Create argument array for `Subprocess()` for a process running in a