mirror of
https://github.com/samba-team/samba.git
synced 2025-02-28 01:58:17 +03:00
lib/util: provide a dbgtext_va() function which takes va_list
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
173a647698
commit
5f4c1542de
@ -1063,17 +1063,14 @@ full:
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
bool dbgtext( const char *format_str, ... )
|
||||
static inline bool __dbgtext_va(const char *format_str, va_list ap) PRINTF_ATTRIBUTE(1,0);
|
||||
static inline bool __dbgtext_va(const char *format_str, va_list ap)
|
||||
{
|
||||
va_list ap;
|
||||
char *msgbuf = NULL;
|
||||
bool ret = true;
|
||||
int res;
|
||||
|
||||
va_start(ap, format_str);
|
||||
res = vasprintf(&msgbuf, format_str, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (res != -1) {
|
||||
format_debug_text(msgbuf);
|
||||
} else {
|
||||
@ -1082,3 +1079,20 @@ full:
|
||||
SAFE_FREE(msgbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool dbgtext_va(const char *format_str, va_list ap)
|
||||
{
|
||||
return __dbgtext_va(format_str, ap);
|
||||
}
|
||||
|
||||
bool dbgtext(const char *format_str, ... )
|
||||
{
|
||||
va_list ap;
|
||||
bool ret;
|
||||
|
||||
va_start(ap, format_str);
|
||||
ret = __dbgtext_va(format_str, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -42,6 +42,7 @@
|
||||
#define MAX_DEBUG_LEVEL 1000
|
||||
#endif
|
||||
|
||||
bool dbgtext_va(const char *, va_list ap) PRINTF_ATTRIBUTE(1,0);
|
||||
bool dbgtext( const char *, ... ) PRINTF_ATTRIBUTE(1,2);
|
||||
bool dbghdrclass( int level, int cls, const char *location, const char *func);
|
||||
bool dbghdr( int level, const char *location, const char *func);
|
||||
|
Loading…
x
Reference in New Issue
Block a user