mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-24 06:12:27 +00:00
Fix some bugs
- addr2line backtrace should continue on eintr - lua crashes if we try to iterate a non-table
This commit is contained in:
parent
6a145a9262
commit
cc0d1ec076
3 changed files with 22 additions and 10 deletions
18
third_party/lua/lrepl.c
vendored
18
third_party/lua/lrepl.c
vendored
|
@ -140,18 +140,20 @@ void lua_readline_completions (const char *p, linenoiseCompletions *c) {
|
|||
}
|
||||
|
||||
// search final object
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, -2)) {
|
||||
if (lua_type(L, -2) == LUA_TSTRING) {
|
||||
name = lua_tostring(L, -2);
|
||||
if (startswithi(name, a)) {
|
||||
lua_readline_addcompletion(c, xasprintf("%.*s%s", a - p, p, name));
|
||||
if (lua_type(L, -1) == LUA_TTABLE) {
|
||||
lua_pushnil(L);
|
||||
while (lua_next(L, -2)) {
|
||||
if (lua_type(L, -2) == LUA_TSTRING) {
|
||||
name = lua_tostring(L, -2);
|
||||
if (startswithi(name, a)) {
|
||||
lua_readline_addcompletion(c, xasprintf("%.*s%s", a - p, p, name));
|
||||
}
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
lua_pop(L, 1);
|
||||
}
|
||||
|
||||
lua_pop(L, 1);
|
||||
lua_pop(L, 1); // pop table
|
||||
|
||||
for (i = 0; i < ARRAYLEN(kKeywordHints); ++i) {
|
||||
if (startswithi(kKeywordHints[i], p)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue