From c39cc421a7f4403af2dbaae8d6161e474ada53d6 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Wed, 16 Sep 2026 16:16:10 +0200 Subject: [PATCH] print: take the message as a pointer to const The strings are literals in code space, so the parameter can say so. Drops six warning 357 from the build. --- rtl837x_common.h | 6 +++--- rtlplayground.c | 6 +++--- test/support.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rtl837x_common.h b/rtl837x_common.h index 71b5547e..2ae75fdf 100644 --- a/rtl837x_common.h +++ b/rtl837x_common.h @@ -135,9 +135,9 @@ extern __xdata uint8_t uip_buf[UIP_CONF_BUFFER_SIZE+2]; extern __xdata struct uip_eth_addr uip_ethaddr; // Headers for calls in the common code area (HOME/BANK0) -void print_string_no_syslog(__code char *p); -void print_string_newline_no_syslog(__code char *p); -void print_string(__code char *p); +void print_string_no_syslog(__code const char *p); +void print_string_newline_no_syslog(__code const char *p); +void print_string(__code const char *p); void print_string_x(__xdata char *p); void print_long(uint32_t a); void print_short(uint16_t a); diff --git a/rtlplayground.c b/rtlplayground.c index a2efbf5a..1151d397 100644 --- a/rtlplayground.c +++ b/rtlplayground.c @@ -303,19 +303,19 @@ void itoa_short(uint16_t v) } -void print_string(__code char *p) +void print_string(__code const char *p) { while (*p) write_char(*p++); } -void print_string_no_syslog(__code char *p) +void print_string_no_syslog(__code const char *p) { while (*p) write_char_no_syslog(*p++); } -void print_string_newline_no_syslog(__code char *p) +void print_string_newline_no_syslog(__code const char *p) { write_char_no_syslog('\n'); print_string_no_syslog(p); diff --git a/test/support.c b/test/support.c index 58e64ad5..1270554f 100644 --- a/test/support.c +++ b/test/support.c @@ -47,7 +47,7 @@ static void out_putc(char c) { /* --- mocked print helpers (signatures match rtl837x_common.h post-shim) ---- */ void write_char(char c) { out_putc(c); } -void print_string(char *p) { while (*p) out_putc(*p++); } +void print_string(const char *p) { while (*p) out_putc(*p++); } void print_string_x(char *p) { while (*p) out_putc(*p++); } void print_cmd_prompt(void) { print_string((char *)"> "); } void itoa(uint8_t v) { /* firmware prints a decimal number */