projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9d60935
)
[lib] add AUBIO_STRERR to log system error messages
author
Paul Brossier
<piem@piem.org>
Sat, 22 Dec 2018 23:06:32 +0000
(
00:06
+0100)
committer
Paul Brossier
<piem@piem.org>
Sat, 22 Dec 2018 23:06:32 +0000
(
00:06
+0100)
src/aubio_priv.h
patch
|
blob
|
history
diff --git
a/src/aubio_priv.h
b/src/aubio_priv.h
index
fa59571
..
ab6afb2
100644
(file)
--- a/
src/aubio_priv.h
+++ b/
src/aubio_priv.h
@@
-62,6
+62,10
@@
#include <string.h>
#endif
#include <string.h>
#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
#ifdef HAVE_LIMITS_H
#include <limits.h> // for CHAR_BIT, in C99 standard
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h> // for CHAR_BIT, in C99 standard
#endif
@@
-330,6
+334,18
@@
uint_t aubio_log(sint_t level, const char_t *fmt, ...);
#define AUBIO_STRERROR(errno,buf,len) strerror_s(buf, len, errno)
#endif
#define AUBIO_STRERROR(errno,buf,len) strerror_s(buf, len, errno)
#endif
+#ifdef HAVE_C99_VARARGS_MACROS
+#define AUBIO_STRERR(...) \
+ char errorstr[256]; \
+ AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); \
+ AUBIO_ERR(__VA_ARGS__)
+#else
+#define AUBIO_STRERR(format, args...) \
+ char errorstr[256]; \
+ AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); \
+ AUBIO_ERR(format, ##args)
+#endif
+
/* handy shortcuts */
#define DB2LIN(g) (POW(10.0,(g)*0.05f))
#define LIN2DB(v) (20.0*LOG10(v))
/* handy shortcuts */
#define DB2LIN(g) (POW(10.0,(g)*0.05f))
#define LIN2DB(v) (20.0*LOG10(v))