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

Function buferror

deps/memkind/src/jemalloc/src/malloc_io.c:108–124  ·  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

106 * provide a wrapper.
107 */
108int
109buferror(int err, char *buf, size_t buflen) {
110#ifdef _WIN32
111 FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0,
112 (LPSTR)buf, (DWORD)buflen, NULL);
113 return 0;
114#elif defined(__GLIBC__) && defined(_GNU_SOURCE)
115 char *b = strerror_r(err, buf, buflen);
116 if (b != buf) {
117 strncpy(buf, b, buflen);
118 buf[buflen-1] = '\0';
119 }
120 return 0;
121#else
122 return strerror_r(err, buf, buflen);
123#endif
124}
125
126uintmax_t
127malloc_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
TEST_BEGINFunction · 0.50

Calls

no outgoing calls

Tested by 4

thd_startFunction · 0.40
mallctl_failureFunction · 0.40
TEST_BEGINFunction · 0.40
TEST_BEGINFunction · 0.40