fbcon: properly use fbuf

pull/2122/head
nick black 3 years ago
parent b13ecb31f9
commit bdc593a8ff
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -155,6 +155,14 @@ fbuf_reset(fbuf* f){
f->used = 0;
}
static inline int
fbuf_reserve(fbuf* f, size_t len){
if(fbuf_grow(f, len)){
return -1;
}
return 0;
}
static inline int
fbuf_putc(fbuf* f, char c){
if(fbuf_grow(f, 1)){

@ -39,8 +39,7 @@ int fbcon_blit(struct ncplane* n, int linesize, const void* data,
int cdimy = s->cellpxy;
// FIXME this will need be a copy of the tinfo's fbuf map
size_t flen = leny * lenx * 4;
s->glyph.buf = malloc(flen);
if(s->glyph.buf == NULL){
if(fbuf_reserve(&s->glyph, flen)){
return -1;
}
tament* tam = NULL;
@ -114,7 +113,7 @@ error:
if(!reuse){
free(tam);
}
free(s->glyph.buf);
fbuf_free(&s->glyph);
s->glyph.size = 0;
return -1;
}

Loading…
Cancel
Save