aboutsummaryrefslogtreecommitdiffstats
path: root/src/text.h
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-20 22:32:04 +0200
committerBad Diode <bd@badd10de.dev>2021-05-20 22:53:09 +0200
commitd81fe3c22410be6beba3577c6985a07483da4694 (patch)
tree232bd4b2867263899b651b342eb38bcbdd50a96c /src/text.h
parentab6fdd0347920cdcda9c4c3c9c3f01996adc48db (diff)
downloaduxngba-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.h18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/text.h b/src/text.h
index eb6149d..1142a73 100644
--- a/src/text.h
+++ b/src/text.h
@@ -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.
253void 253
254txt_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
265void 261void
266txt_clear_line_tiled(void) { 262txt_clear_line_tiled(void) {