forked from old/legacy-imlib2
Introduce __imlib_perror() to produce error messages
This commit is contained in:
parent
c44f3a4124
commit
11cef49cef
|
@ -107,6 +107,9 @@ unsigned int __imlib_time_us(void);
|
|||
|
||||
#endif /* IMLIB2_DEBUG */
|
||||
|
||||
#define E(fmt...) __imlib_perror(DBG_PFX, fmt)
|
||||
__PRINTF_2__ void __imlib_perror(const char *pfx, const char *fmt, ...);
|
||||
|
||||
/* image.h */
|
||||
|
||||
/* 32767 is the maximum pixmap dimension and ensures that
|
||||
|
|
|
@ -69,7 +69,26 @@ __imlib_printf(const char *pfx, const char *fmt, ...)
|
|||
fmt = fmtx;
|
||||
}
|
||||
vfprintf(opt_fout, fmt, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#endif /* IMLIB2_DEBUG */
|
||||
|
||||
__EXPORT__ void
|
||||
__imlib_perror(const char *pfx, const char *fmt, ...)
|
||||
{
|
||||
char fmtx[1024];
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
|
||||
if (pfx)
|
||||
{
|
||||
snprintf(fmtx, sizeof(fmtx), "ERROR: %-4s: %s", pfx, fmt);
|
||||
fmt = fmtx;
|
||||
}
|
||||
vfprintf(stderr, fmt, args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
|
|
@ -33,4 +33,6 @@ unsigned int __imlib_time_us(void);
|
|||
|
||||
#endif /* IMLIB2_DEBUG */
|
||||
|
||||
__PRINTF_2__ void __imlib_perror(const char *pfx, const char *fmt, ...);
|
||||
|
||||
#endif /* IMLIB2_DEDUG_H */
|
||||
|
|
Loading…
Reference in New Issue