--- libelwix/inc/elwix.h 2013/07/07 21:05:58 1.7.2.1 +++ libelwix/inc/elwix.h 2014/01/29 14:15:57 1.9.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: elwix.h,v 1.7.2.1 2013/07/07 21:05:58 misho Exp $ +* $Id: elwix.h,v 1.9.2.1 2014/01/29 14:15:57 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 +Copyright 2004 - 2014 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -71,6 +71,7 @@ SUCH DAMAGE. #include #include #include +#include #ifndef STRSIZ @@ -155,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 @@ -204,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) @@ -222,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) \