From: Florian Forster Date: Sat, 4 Nov 2017 18:28:34 +0000 (+0100) Subject: daemon/common.h: Add the STRERROR() and STRERRNO macros. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a6a884d250900f2d7abcd1523aa4d97db520b9c2;p=collectd.git daemon/common.h: Add the STRERROR() and STRERRNO macros. --- diff --git a/src/daemon/common.h b/src/daemon/common.h index 7f860521..cf4c5a71 100644 --- a/src/daemon/common.h +++ b/src/daemon/common.h @@ -73,6 +73,13 @@ char *sstrdup(const char *s); void *smalloc(size_t size); char *sstrerror(int errnum, char *buf, size_t buflen); +#ifndef ERRBUF_SIZE +#define ERRBUF_SIZE 256 +#endif + +#define STRERROR(e) sstrerror((e), (char[ERRBUF_SIZE]){0}, ERRBUF_SIZE) +#define STRERRNO STRERROR(errno) + /* * NAME * sread