mirror of
git://projects.qi-hardware.com/ben-blinkenlights.git
synced 2024-11-16 20:39:22 +02:00
ubb-la/gui.c (textf): vasprintf ain't alloca, so we need to free()
This commit is contained in:
parent
cdcfb6c181
commit
52c3dcc16a
13
ubb-la/gui.c
13
ubb-la/gui.c
@ -122,17 +122,18 @@ static void update(void)
|
||||
static void textf(int x, int y, uint32_t color, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *s;
|
||||
char *tmp, *s;
|
||||
uint8_t *p;
|
||||
int ix, iy;
|
||||
int res;
|
||||
|
||||
va_start(ap, fmt);
|
||||
res = vasprintf(&s, fmt, ap);
|
||||
if (vasprintf(&tmp, fmt, ap) < 0) {
|
||||
perror("vasprintf");
|
||||
exit(1);
|
||||
}
|
||||
va_end(ap);
|
||||
(void) res;
|
||||
|
||||
while (*s) {
|
||||
for (s = tmp; *s; s++) {
|
||||
p = gfxPrimitivesFontdata+(*s << 3);
|
||||
for (iy = 0; iy != 8; iy++) {
|
||||
for (ix = 0; ix != 8; ix++)
|
||||
@ -141,8 +142,8 @@ static void textf(int x, int y, uint32_t color, const char *fmt, ...)
|
||||
p++;
|
||||
}
|
||||
x += 8;
|
||||
s++;
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user