--- libelwix/inc/elwix.h 2013/06/20 08:03:45 1.5.2.1 +++ libelwix/inc/elwix.h 2013/12/15 22:54:41 1.9 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: elwix.h,v 1.5.2.1 2013/06/20 08:03:45 misho Exp $ +* $Id: elwix.h,v 1.9 2013/12/15 22:54:41 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -53,6 +53,7 @@ SUCH DAMAGE. #include #include #include +#include #include #include #include @@ -69,6 +70,8 @@ SUCH DAMAGE. #include #include #include +#include +#include #ifndef STRSIZ @@ -153,6 +156,9 @@ SUCH DAMAGE. #define VACUUM_BETWEEN 2 +extern int __isthreaded; + + // elwix_SetProg() Set program memory pool name void elwix_SetProg(const char *csProgName); // elwix_GetProg() Get program memory pool name @@ -202,10 +208,10 @@ extern int elwix_Verbose; #define EVERBS(x) if ((x) <= elwix_Verbose) #define EVERBOSE(x, fmt, ...) do { assert((fmt)); \ if ((x) <= elwix_Verbose) { \ - char str[BUFSIZ] = { 0 }; \ - snprintf(str, sizeof str, (fmt), ##__VA_ARGS__); \ + char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_DEBUG, "Verbose(%d):%s(%d): %s\n", \ - (x), __func__, __LINE__, str); \ + (x), __func__, __LINE__, __str); \ } \ } while (0) @@ -220,27 +226,27 @@ extern int elwix_Debug; syslog(LOG_DEBUG, "I'm in %s(%d)\n", __func__, __LINE__) #define EDEBUG(x, fmt, ...) do { assert((fmt)); \ if ((x) & elwix_Debug) { \ - char str[BUFSIZ] = { 0 }; \ - snprintf(str, sizeof str, (fmt), ##__VA_ARGS__); \ + char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_DEBUG, "Debug(%d):%s(%d): %s\n", \ - (x), __func__, __LINE__, str); \ + (x), __func__, __LINE__, __str); \ } \ } while (0) /* Logger macro */ #define ELOGGER(x, fmt, ...) do { assert((fmt)); \ - char str[BUFSIZ] = { 0 }; \ - snprintf(str, sizeof str, (fmt), ##__VA_ARGS__); \ + char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog((x), "Logger:%s(%d): %s\n", \ - __func__, __LINE__, str); \ + __func__, __LINE__, __str); \ } while (0) /* Error state macros */ #define EERROR(x, fmt, ...) do { assert((fmt)); \ - char str[BUFSIZ] = { 0 }; \ - snprintf(str, sizeof str, (fmt), ##__VA_ARGS__); \ + char __str[BUFSIZ] = { [0 ... BUFSIZ - 1] = 0 }; \ + snprintf(__str, sizeof __str, (fmt), ##__VA_ARGS__); \ syslog(LOG_ERR, "Error:%s(%d): #%d - %s\n", \ - __func__, __LINE__, (x), str); \ + __func__, __LINE__, (x), __str); \ } while (0) #define ESYSERR(x) do { \ if (x > 0 || errno) \