1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

debug: Call depth: Indent the debug text

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15287

Signed-off-by: Pavel Filipenský <pfilipensky@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Pavel Filipenský 2022-08-26 11:42:42 +02:00 committed by Andreas Schneider
parent 7ba3b1b09d
commit 3b1b37b1cf

View File

@ -1635,8 +1635,21 @@ static void format_debug_text( const char *msg )
for( i = 0; msg[i]; i++ ) {
/* Indent two spaces at each new line. */
if(timestamp && 0 == format_pos) {
/* Limit the maximum indentation to 20 levels */
size_t depth = MIN(20, debug_call_depth);
format_bufr[0] = format_bufr[1] = ' ';
format_pos = 2;
/*
* Indent by four spaces for each depth level,
* but only if the current debug level is >= 8.
*/
if (depth > 0 && debuglevel_get() >= 8 &&
format_pos + 4 * depth < FORMAT_BUFR_SIZE) {
memset(&format_bufr[format_pos],
' ',
4 * depth);
format_pos += 4 * depth;
}
}
/* If there's room, copy the character to the format buffer. */