mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 11:40:22 +00:00
log_vprintf: return void instead of int
The returned value was actually incorrect (counting also formatting escape sequences and terminating nul byte). Since the return value should not be important for the caller, it is perhaps better not to complicate and don't return anything.
This commit is contained in:
@@ -86,12 +86,12 @@ static void _dprintf(const char *format, ...)
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
int log_vprintf(int level, const char *format, va_list ap)
|
||||
void log_vprintf(int level, const char *format, va_list ap)
|
||||
{
|
||||
va_list aq;
|
||||
|
||||
if (log_level < level) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
// get number of required bytes
|
||||
@@ -122,9 +122,7 @@ int log_vprintf(int level, const char *format, va_list ap)
|
||||
} else {
|
||||
prune_ansi_sequences_inplace(buf.get());
|
||||
}
|
||||
int ret = buf.get().size();
|
||||
buf.submit();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void log_msg(int level, const char *format, ...) {
|
||||
@@ -132,7 +130,6 @@ void log_msg(int level, const char *format, ...) {
|
||||
va_start(ap, format);
|
||||
log_vprintf(level, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
}
|
||||
|
||||
void log_msg_once(int level, uint32_t id, const char *msg, ...) {
|
||||
|
||||
@@ -92,7 +92,7 @@ void debug_file_dump(const char *key, void (*serialize)(const void *data, FILE *
|
||||
///#define debug_msg(...) log_msg(LOG_LEVEL_DEBUG, "[pid/%d +%d %s] ", getpid(), __LINE__, __FILE__), log_msg(LOG_LEVEL_DEBUG, __VA_ARGS__)
|
||||
#define debug_msg(...) log_msg(LOG_LEVEL_DEBUG, __VA_ARGS__)
|
||||
void log_msg(int log_level, const char *format, ...) ATTRIBUTE(format (printf, 2, 3));
|
||||
int log_vprintf(int level, const char *format, va_list ap);
|
||||
void log_vprintf(int level, const char *format, va_list ap);
|
||||
void log_msg_once(int log_level, uint32_t id, const char *msg, ...) ATTRIBUTE(format (printf, 3, 4));;
|
||||
void log_perror(int log_level, const char *msg);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user