Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lol-html
Submodule lol-html updated 190 files
20 changes: 9 additions & 11 deletions lolhtml.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,23 @@ typedef struct {
int callback_index;
} handler_data_t;

static void push_lol_str_maybe(lua_State *L, lol_html_str_t *s) {
if (s == NULL) {
static void push_lol_str_maybe(lua_State *L, lol_html_str_t s) {
if (s.len == 0) {
lua_pushnil(L);
} else {
lua_pushlstring(L, s->data, s->len);
lol_html_str_free(*s);
free(s);
lua_pushlstring(L, s.data, s.len);
lol_html_str_free(s);
}
}

static int push_last_error(lua_State *L) {
lol_html_str_t *err = lol_html_take_last_error();
lol_html_str_t err = lol_html_take_last_error();
lua_pushnil(L);
if (err == NULL) {
if (err.len == 0) {
lua_pushliteral(L, "unknown error");
} else {
lua_pushlstring(L, err->data, err->len);
lol_html_str_free(*err);
free(err);
lua_pushlstring(L, err.data, err.len);
lol_html_str_free(err);
}
return 2;
}
Expand Down Expand Up @@ -263,7 +261,7 @@ static int text_chunk_get_text(lua_State *L) {
}

static int text_chunk_is_last_in_text_node(lua_State *L) {
const lol_html_text_chunk_t **chunk = check_valid_udata(L, 1, PREFIX "text_chunk");
lol_html_text_chunk_t **chunk = check_valid_udata(L, 1, PREFIX "text_chunk");
lua_pushboolean(L, lol_html_text_chunk_is_last_in_text_node(*chunk));
return 1;
}
Expand Down