From: Chip Turner Date: Mon, 21 Sep 2015 22:58:03 +0000 (-0700) Subject: Move definition of strlcpy to outside an #if X-Git-Tag: deprecate-dynamic-initializer~384 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e8c07bf4d7268902625b77e55a11d61bb4a2205e;p=folly.git Move definition of strlcpy to outside an #if Summary: Looks like some platforms fail to build (open source, not internal) due to #if conditional. Reviewed By: @ldemailly Differential Revision: D2464555 --- diff --git a/folly/Demangle.cpp b/folly/Demangle.cpp index 54b46d27..47f151e2 100644 --- a/folly/Demangle.cpp +++ b/folly/Demangle.cpp @@ -91,16 +91,6 @@ void demangleCallback(const char* str, size_t size, void* p) { } // namespace -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; -} - size_t demangle(const char* name, char* out, size_t outSize) { DemangleBuf dbuf; dbuf.dest = out; @@ -134,4 +124,14 @@ size_t demangle(const char* name, char* out, size_t outSize) { #endif +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; +} + } // folly