Skip to content

Commit

Permalink
chore: improve code via use ctype_ptr_to
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Jan 16, 2025
1 parent 8aebbe6 commit 4444612
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ static int cdata_index_common(lua_State *L, bool to)
case CTYPE_RECORD:
return cdata_index_crecord(L, cd, ct, to);
case CTYPE_PTR:
if (ct->ptr->type == CTYPE_RECORD && lua_type(L, 2) == LUA_TSTRING)
if (ctype_ptr_to(ct, CTYPE_RECORD) && lua_type(L, 2) == LUA_TSTRING)
return cdata_index_crecord(L, cd, ct->ptr, to);
return cdata_index_ptr(L, cd, ct->ptr, to);
case CTYPE_ARRAY:
Expand Down

0 comments on commit 4444612

Please sign in to comment.