Fix title handling

This commit is contained in:
Dimitri Lozeve 2024-09-21 13:57:26 +02:00
parent 3021529d92
commit b7203383a7
3 changed files with 9 additions and 5 deletions

8
lib.c
View file

@ -1,10 +1,14 @@
#include "fenster/fenster.h"
#include <stdlib.h>
#include <string.h>
struct fenster *fenster_init(int width, int height, char *title) {
struct fenster *fenster_init(int width, int height, int title_length,
char title[title_length]) {
uint32_t *buf = calloc(width * height, sizeof(uint32_t));
char *title_init = malloc(title_length);
memcpy(title_init, title, title_length);
struct fenster f_init = {
.title = title,
.title = title_init,
.width = width,
.height = height,
.buf = buf,