summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/luavgl/src/font.c36
-rw-r--r--lib/luavgl/src/luavgl.h2
2 files changed, 4 insertions, 34 deletions
diff --git a/lib/luavgl/src/font.c b/lib/luavgl/src/font.c
index 95f2a6f1..383f5974 100644
--- a/lib/luavgl/src/font.c
+++ b/lib/luavgl/src/font.c
@@ -240,7 +240,7 @@ static int luavgl_font_create(lua_State *L)
{
int weight;
int size;
- char *str, *name;
+ const char *name;
const lv_font_t *font = NULL;
if (!lua_isstring(L, 1)) {
@@ -271,39 +271,9 @@ static int luavgl_font_create(lua_State *L)
weight = FONT_WEIGHT_NORMAL;
}
- str = strdup(lua_tostring(L, 1));
- if (str == NULL) {
- return luaL_error(L, "no memory.");
- }
-
- name = to_lower(str);
- while (*name) {
- if (*name == ' ') {
- name++;
- continue;
- }
-
- char *end = strchr(name, ',');
- if (end != NULL) {
- *end = '\0';
- } else {
- end = name + strlen(name);
- }
-
- char *trim = end - 1;
- while (*trim == ' ') {
- *trim-- = '\0'; /* trailing space. */
- }
-
- font = _luavgl_font_create(L, name, size, weight);
- if (font) {
- break;
- }
-
- name = end + 1; /* next */
- }
+ name = lua_tostring(L, 1);
+ font = _luavgl_font_create(L, name, size, weight);
- free(str);
if (font) {
lua_pushlightuserdata(L, (void *)font);
return 1;
diff --git a/lib/luavgl/src/luavgl.h b/lib/luavgl/src/luavgl.h
index 37e7134b..b26bb5c7 100644
--- a/lib/luavgl/src/luavgl.h
+++ b/lib/luavgl/src/luavgl.h
@@ -14,7 +14,7 @@ extern "C" {
typedef const lv_font_t *(*make_font_cb)(const char *name, int size,
int weight);
-typedef void (*delete_font_cb)(const lv_font_t *);
+typedef void (*delete_font_cb)(lv_font_t *);
typedef int (*luavgl_pcall_t)(lua_State *L, int nargs, int nresults);
typedef struct {