Remove the strings.h portability header
authorChristopher Dykes <cdykes@fb.com>
Fri, 15 Apr 2016 17:57:01 +0000 (10:57 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Fri, 15 Apr 2016 18:05:23 +0000 (11:05 -0700)
Summary:Although, according to the manpage, these functions are defined in `strings.h`, but they are also defined in `string.h`. We never actually use these functions via `strings.h`, and instead only ever reference them via `string.h`.
To keep things sane, lets just move the functions into `string.h` and kill `strings.h`.

Reviewed By: yfeldblum

Differential Revision: D3181596

fb-gh-sync-id: 8a474df510ddafc4c595b08b809a7c33e3256177
fbshipit-source-id: 8a474df510ddafc4c595b08b809a7c33e3256177

folly/Makefile.am
folly/portability/String.cpp
folly/portability/String.h
folly/portability/Strings.cpp [deleted file]
folly/portability/Strings.h [deleted file]

index 95f36ac384d7dff7631af5247a196c1d4b6935d5..2c1995404e02496196d1374081482fef037f8047 100644 (file)
@@ -282,7 +282,6 @@ nobase_follyinclude_HEADERS = \
        portability/Memory.h \
        portability/PThread.h \
        portability/String.h \
-       portability/Strings.h \
        portability/Syslog.h \
        portability/SysFile.h \
        portability/SysMman.h \
@@ -428,7 +427,6 @@ libfolly_la_SOURCES = \
        portability/Malloc.cpp \
        portability/Memory.cpp \
        portability/String.cpp \
-       portability/Strings.cpp \
        portability/SysFile.cpp \
        portability/SysMman.cpp \
        portability/SysResource.cpp \
index e48076b1415b845d561571ad4836f8ebecaa188a..48ae5124d9a0aec67ed06dbace6ebe24d93a4619 100755 (executable)
@@ -44,7 +44,21 @@ extern "C" char* strndup(const char* a, size_t len) {
 #endif
 
 #ifdef _WIN32
-extern "C" char* strtok_r(char* str, char const* delim, char** ctx) {
+extern "C" {
+void bzero(void* s, size_t n) {
+  memset(s, 0, n);
+}
+
+int strcasecmp(const char* a, const char* b) {
+  return _stricmp(a, b);
+}
+
+int strncasecmp(const char* a, const char* b, size_t c) {
+  return _strnicmp(a, b, c);
+}
+
+char* strtok_r(char* str, char const* delim, char** ctx) {
   return strtok_s(str, delim, ctx);
 }
+}
 #endif
index d9022cde8eb1f8cf83351077be08d9351f62f4d1..f7b296a8eb387d599a93517525e986ec7a6cfb1b 100755 (executable)
@@ -30,5 +30,10 @@ extern "C" char* strndup(const char* a, size_t len);
 #endif
 
 #ifdef _WIN32
-extern "C" char* strtok_r(char* str, char const* delim, char** ctx);
+extern "C" {
+void bzero(void* s, size_t n);
+int strcasecmp(const char* a, const char* b);
+int strncasecmp(const char* a, const char* b, size_t c);
+char* strtok_r(char* str, char const* delim, char** ctx);
+}
 #endif
diff --git a/folly/portability/Strings.cpp b/folly/portability/Strings.cpp
deleted file mode 100755 (executable)
index ea51f37..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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/portability/Strings.h>
-
-#ifdef _WIN32
-#include <string.h>
-
-extern "C" {
-void bzero(void* s, size_t n) { memset(s, 0, n); }
-
-int strcasecmp(const char* a, const char* b) { return _stricmp(a, b); }
-
-int strncasecmp(const char* a, const char* b, size_t c) {
-  return _strnicmp(a, b, c);
-}
-}
-#endif
diff --git a/folly/portability/Strings.h b/folly/portability/Strings.h
deleted file mode 100755 (executable)
index 3c0b016..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-#ifndef _WIN32
-#include <strings.h>
-#else
-#include <cstdint>
-
-extern "C" {
-void bzero(void* s, size_t n);
-int strcasecmp(const char* a, const char* b);
-int strncasecmp(const char* a, const char* b, size_t c);
-}
-#endif