MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / buferror

Function buferror

deps/jemalloc/src/malloc_io.c:95–111  ·  view source on GitHub ↗

* glibc provides a non-standard strerror_r() when _GNU_SOURCE is defined, so * provide a wrapper. */

Source from the content-addressed store, hash-verified

93 * provide a wrapper.
94 */
95int
96buferror(int err, char *buf, size_t buflen) {
97#ifdef _WIN32
98 FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0,
99 (LPSTR)buf, (DWORD)buflen, NULL);
100 return 0;
101#elif defined(JEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE) && defined(_GNU_SOURCE)
102 char *b = strerror_r(err, buf, buflen);
103 if (b != buf) {
104 strncpy(buf, b, buflen);
105 buf[buflen-1] = '\0';
106 }
107 return 0;
108#else
109 return strerror_r(err, buf, buflen);
110#endif
111}
112
113uintmax_t
114malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base) {

Callers 5

pages.cFile · 0.70
thd_startFunction · 0.50
mallctl_failureFunction · 0.50
TEST_BEGINFunction · 0.50
aligned_alloc.cFile · 0.50

Calls

no outgoing calls

Tested by 3

thd_startFunction · 0.40
mallctl_failureFunction · 0.40
TEST_BEGINFunction · 0.40