mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-28 09:22:27 +01:00
Fold many functions into one
The result is not much more convoluted than the original was, but much shorter. Several vararg macros were added -- no idea what !gcc compilers make of this. The messages sent to these functions are inconsistent across the source tree. I have now decided that the logging function will add the final newline - messages will need to be modified accordingly. I have no idea why the original implementation was as complicated and ugly as it was. My guess is that it was anticipated that these are be called from sighandlers, but why no snprintf when they are all stuffed up with vsnprintf... Still, the result is not worse in this regard either.
This commit is contained in:
committed by
Carlos R. Mafra
parent
63e4338284
commit
109e504262
@@ -219,11 +219,22 @@ waborthandler* wsetabort(waborthandler* handler);
|
||||
/* don't free the returned string */
|
||||
char* wstrerror(int errnum);
|
||||
|
||||
void wmessage(const char *msg, ...) __attribute__((__format__(printf,1,2)));
|
||||
void wwarning(const char *msg, ...) __attribute__((__format__(printf,1,2)));
|
||||
void wfatal(const char *msg, ...) __attribute__((__format__(printf,1,2)));
|
||||
void wsyserror(const char *msg, ...) __attribute__((__format__(printf,1,2)));
|
||||
void wsyserrorwithcode(int error, const char *msg, ...) __attribute__((__format__(printf,2,3)));
|
||||
enum {
|
||||
WMESSAGE_TYPE_MESSAGE,
|
||||
WMESSAGE_TYPE_WARNING,
|
||||
WMESSAGE_TYPE_FATAL,
|
||||
WMESSAGE_TYPE_WSYSERROR,
|
||||
WMESSAGE_TYPE_WSYSERRORWITHCODE
|
||||
};
|
||||
|
||||
#define wmessage(fmt, args...) __wmessage( WMESSAGE_TYPE_MESSAGE, NULL, fmt, ## args)
|
||||
#define wwarning(fmt, args...) __wmessage( WMESSAGE_TYPE_WARNING, NULL, fmt, ## args)
|
||||
#define wfatal(fmt, args...) __wmessage( WMESSAGE_TYPE_FATAL, NULL, fmt, ## args)
|
||||
#define wsyserror(fmt, args...) __wmessage( WMESSAGE_TYPE_WSYSERROR, NULL, fmt, ## args)
|
||||
#define wsyserrorwithcode(errno, fmt, args...) \
|
||||
__wmessage( WMESSAGE_TYPE_WSYSERRORWITHCODE, &errno, fmt, ## args)
|
||||
|
||||
void __wmessage(int type, void *extra, const char *msg, ...) __attribute__((__format__(printf,3,4)));
|
||||
|
||||
char* wfindfile(char *paths, char *file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user