diff options
author | Keith Packard <keithp@keithp.com> | 2011-07-06 13:21:25 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-07-06 13:21:25 -0700 |
commit | 480b48837db31987b947e4d32248965d4a16be03 (patch) | |
tree | 3027a076af9376d87ec56735791c3cae518c9682 | |
parent | 41c230cac359b4459ca93196d08704b7d35447c7 (diff) |
altos: Shrink ao_config_callsign_set
Replacing a hand-coded memset with a function call, using static space
instead of stack space for an array.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | src/ao_config.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/ao_config.c b/src/ao_config.c index c7fc7dd2..2434bc6c 100644 --- a/src/ao_config.c +++ b/src/ao_config.c @@ -116,8 +116,9 @@ void ao_config_callsign_set(void) __reentrant { uint8_t c; - char callsign[AO_MAX_CALLSIGN + 1]; + static __xdata char callsign[AO_MAX_CALLSIGN + 1]; + memset(callsign, '\0', sizeof callsign); ao_cmd_white(); c = 0; while (ao_cmd_lex_c != '\n') { @@ -131,8 +132,6 @@ ao_config_callsign_set(void) __reentrant return; ao_mutex_get(&ao_config_mutex); _ao_config_get(); - while (c < AO_MAX_CALLSIGN + 1) - callsign[c++] = '\0'; memcpy(&ao_config.callsign, &callsign, AO_MAX_CALLSIGN + 1); ao_config_dirty = 1; |