diff options
author | Bad Diode <bd@badd10de.dev> | 2021-05-20 22:32:04 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-05-20 22:53:09 +0200 |
commit | d81fe3c22410be6beba3577c6985a07483da4694 (patch) | |
tree | 232bd4b2867263899b651b342eb38bcbdd50a96c /src/text.h | |
parent | ab6fdd0347920cdcda9c4c3c9c3f01996adc48db (diff) | |
download | uxngba-d81fe3c22410be6beba3577c6985a07483da4694.tar.gz uxngba-d81fe3c22410be6beba3577c6985a07483da4694.zip |
Apply asie's patch 2 for performance optimizations
This patch replaces the txt_printf with the public domain posprintf
library.
Diffstat (limited to 'src/text.h')
-rw-r--r-- | src/text.h | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -250,17 +250,13 @@ txt_init_hybrid(TextMode mode, Font font, u32 *buf) { | |||
250 | } | 250 | } |
251 | 251 | ||
252 | // Print text to the screen with formatting. | 252 | // Print text to the screen with formatting. |
253 | void | 253 | |
254 | txt_printf(char *msg, ...) { | 254 | #define txt_printf(msg, ...) \ |
255 | va_list arg_list; | 255 | { \ |
256 | va_start(arg_list, msg); | 256 | char buf[256] = {0}; \ |
257 | char buf[512] = {0}; | 257 | posprintf(buf, msg, ##__VA_ARGS__); \ |
258 | // TODO: This call pulls in malloc() and a bunch of other things. | 258 | txt_puts(buf); \ |
259 | // To reduce memory usage and filesize, it would be advisable | 259 | } |
260 | // to replace it with something simpler. | ||
261 | vsiprintf(buf, msg, arg_list); | ||
262 | txt_puts(buf); | ||
263 | } | ||
264 | 260 | ||
265 | void | 261 | void |
266 | txt_clear_line_tiled(void) { | 262 | txt_clear_line_tiled(void) { |