Commit f8e41896 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

Cut old memrchr port in global namespace

Summary:
[Folly] Cut old memrchr port in global namespace since it is excessively difficult to make it portable across all platforms.

Fixes: https://github.com/facebook/folly/issues/817.
Fixes: https://github.com/facebook/folly/issues/1391.

Reviewed By: Orvid

Differential Revision: D22130039

fbshipit-source-id: 43511aa95c749d5f603ff8043c438ba63d44f6c1
parent fb5ce2d9
......@@ -16,17 +16,6 @@
#include <folly/portability/String.h>
#if !FOLLY_HAVE_MEMRCHR
extern "C" void* memrchr(const void* s, int c, size_t n) {
for (auto p = ((const char*)s) + n - 1; p >= (const char*)s; p--) {
if (*p == (char)c) {
return (void*)p;
}
}
return nullptr;
}
#endif
#if defined(_WIN32) || defined(__FreeBSD__)
extern "C" char* strndup(const char* a, size_t len) {
auto neededLen = strlen(a);
......
......@@ -25,10 +25,6 @@
#include <strings.h>
#endif
#if !FOLLY_HAVE_MEMRCHR
extern "C" void* memrchr(const void* s, int c, size_t n);
#endif
#if defined(_WIN32) || defined(__FreeBSD__)
extern "C" char* strndup(const char* a, size_t len);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment