font: optimise font_wrap
parent
c25f4ba912
commit
6743bc18fd
|
@ -363852,11 +363852,10 @@ const char *font_wrap(const char *text, float max_width) {
|
|||
|
||||
array(char*) words = strsplit(text, " ");
|
||||
static __thread int slot = 0;
|
||||
static __thread char *buf[16] = {0};
|
||||
static __thread char *buf[16][FONT_MAX_STRING_LEN] = {0};
|
||||
|
||||
int len = strlen(text) + array_count(words);
|
||||
slot = (slot+1) % 16;
|
||||
buf[slot] = REALLOC(buf[slot], len+1);
|
||||
memset(buf[slot], 0, len+1);
|
||||
|
||||
char *out = buf[slot];
|
||||
|
|
|
@ -2295,11 +2295,10 @@ const char *font_wrap(const char *text, float max_width) {
|
|||
|
||||
array(char*) words = strsplit(text, " ");
|
||||
static __thread int slot = 0;
|
||||
static __thread char *buf[16] = {0};
|
||||
static __thread char *buf[16][FONT_MAX_STRING_LEN] = {0};
|
||||
|
||||
int len = strlen(text) + array_count(words);
|
||||
slot = (slot+1) % 16;
|
||||
buf[slot] = REALLOC(buf[slot], len+1);
|
||||
memset(buf[slot], 0, len+1);
|
||||
|
||||
char *out = buf[slot];
|
||||
|
|
|
@ -10993,11 +10993,10 @@ const char *font_wrap(const char *text, float max_width) {
|
|||
|
||||
array(char*) words = strsplit(text, " ");
|
||||
static __thread int slot = 0;
|
||||
static __thread char *buf[16] = {0};
|
||||
static __thread char *buf[16][FONT_MAX_STRING_LEN] = {0};
|
||||
|
||||
int len = strlen(text) + array_count(words);
|
||||
slot = (slot+1) % 16;
|
||||
buf[slot] = REALLOC(buf[slot], len+1);
|
||||
memset(buf[slot], 0, len+1);
|
||||
|
||||
char *out = buf[slot];
|
||||
|
|
Loading…
Reference in New Issue