Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 165d624

Browse filesBrowse files
log_printf: Restructured log_printf for wrapping (espressif#7567)
1 parent 3af0b44 commit 165d624
Copy full SHA for 165d624

File tree

Expand file treeCollapse file tree

1 file changed

+11
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-5
lines changed

‎cores/esp32/esp32-hal-uart.c

Copy file name to clipboardExpand all lines: cores/esp32/esp32-hal-uart.c
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -496,21 +496,18 @@ int uartGetDebug()
496496
return s_uart_debug_nr;
497497
}
498498

499-
int log_printf(const char *format, ...)
499+
int log_printfv(const char *format, va_list arg)
500500
{
501501
static char loc_buf[64];
502502
char * temp = loc_buf;
503503
int len;
504-
va_list arg;
505504
va_list copy;
506-
va_start(arg, format);
507505
va_copy(copy, arg);
508506
len = vsnprintf(NULL, 0, format, copy);
509507
va_end(copy);
510508
if(len >= sizeof(loc_buf)){
511509
temp = (char*)malloc(len+1);
512510
if(temp == NULL) {
513-
va_end(arg);
514511
return 0;
515512
}
516513
}
@@ -528,13 +525,22 @@ int log_printf(const char *format, ...)
528525
xSemaphoreGive(_uart_bus_array[s_uart_debug_nr].lock);
529526
}
530527
#endif
531-
va_end(arg);
532528
if(len >= sizeof(loc_buf)){
533529
free(temp);
534530
}
535531
return len;
536532
}
537533

534+
int log_printf(const char *format, ...)
535+
{
536+
int len;
537+
va_list arg;
538+
va_start(arg, format);
539+
len = log_printfv(format, arg);
540+
va_end(arg);
541+
return len;
542+
}
543+
538544

539545
static void log_print_buf_line(const uint8_t *b, size_t len, size_t total_len){
540546
for(size_t i = 0; i<len; i++){

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.