From 2e2529be27ab61dc0a2a999b920f477179844312 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Thu, 3 Sep 2026 21:27:02 +0200 Subject: [PATCH] syslog: print the server address with print_ip() The status line built the dotted quad by hand, which is what print_ip() from cmd_parser.c already does. Reusing it drops seven calls to one and takes 48 bytes off BANK2. The prototype is not __banked because cmd_parser.c and syslog.c are both in BANK2; a plain call is what the compiler needs here. Should either file move to another bank, this has to become __banked with it. --- cmd_parser.h | 1 + syslog.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd_parser.h b/cmd_parser.h index a8bf7975..0afd0327 100644 --- a/cmd_parser.h +++ b/cmd_parser.h @@ -13,6 +13,7 @@ void cmd_tokenize(void) __banked; void cmd_parser(void) __banked; void execute_config(void) __banked; void execute_commands(__xdata uint8_t *p) __banked; +void print_ip(__xdata uint8_t *ptr); void print_sw_version(void) __banked; void clear_command_history(void) __banked; diff --git a/syslog.c b/syslog.c index c552ac58..de11af53 100644 --- a/syslog.c +++ b/syslog.c @@ -1,5 +1,6 @@ #include "machine.h" #include "syslog.h" +#include "cmd_parser.h" #include "uip/uip.h" #include "rtl837x_common.h" @@ -35,8 +36,7 @@ void syslog_start(void) __banked return; } print_string_newline_no_syslog("Started syslog to IP "); - itoa(state.server_ip[0]); write_char('.'); itoa(state.server_ip[1]); write_char('.'); - itoa(state.server_ip[2]); write_char('.'); itoa(state.server_ip[3]); + print_ip(state.server_ip); write_char(':'); itoa_short(state.server_port); write_char('\n'); state.enabled = 1; }