Revert "Make strlcpy available in folly" (D2062632)

Summary:
Reverting diff to fix the build.

Test Plan: contbuild rule that failed to build is okay now

Reviewed By: ldbrandy@fb.com
This commit is contained in:
Chip Turner
2015-05-22 17:48:35 -07:00
committed by woo
parent bc34a5a774
commit c947d451ab
3 changed files with 17 additions and 16 deletions
+17 -3
View File
@@ -20,7 +20,6 @@
#include <string.h>
#include <folly/Malloc.h>
#include <folly/String.h>
#if FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK
# include <cxxabi.h>
@@ -56,6 +55,21 @@ extern "C" int cplus_demangle_v3_callback(
#endif
namespace {
// glibc doesn't have strlcpy
size_t my_strlcpy(char* dest, const char* src, size_t size) {
size_t len = strlen(src);
if (size != 0) {
size_t n = std::min(len, size - 1); // always null terminate!
memcpy(dest, src, n);
dest[n] = '\0';
}
return len;
}
} // namespace
namespace folly {
#if FOLLY_HAVE_CPLUS_DEMANGLE_V3_CALLBACK
@@ -105,7 +119,7 @@ size_t demangle(const char* name, char* out, size_t outSize) {
demangleCallback,
&dbuf);
if (status == 0) { // failed, return original
return folly::strlcpy(out, name, outSize);
return my_strlcpy(out, name, outSize);
}
if (outSize != 0) {
*dbuf.dest = '\0';
@@ -120,7 +134,7 @@ fbstring demangle(const char* name) {
}
size_t demangle(const char* name, char* out, size_t outSize) {
return folly::strlcpy(out, name, outSize);
return my_strlcpy(out, name, outSize);
}
#endif
-10
View File
@@ -492,16 +492,6 @@ void toLowerAscii(char* str, size_t length) {
}
}
size_t strlcpy(char* dest, const char* const src, size_t size) {
size_t len = strlen(src);
if (size != 0) {
size_t n = std::min(len, size - 1); // always null terminate!
memcpy(dest, src, n);
dest[n] = '\0';
}
return len;
}
namespace detail {
size_t hexDumpLine(const void* ptr, size_t offset, size_t size,
-3
View File
@@ -569,9 +569,6 @@ inline void toLowerAscii(MutableStringPiece str) {
toLowerAscii(str.begin(), str.size());
}
// glibc doesn't have strlcpy
size_t strlcpy(char* dest, const char* const src, size_t size);
} // namespace folly
// Hook into boost's type traits