Skip to content

Commit

Permalink
improve code via use ctype_ptr_to
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <[email protected]>
  • Loading branch information
zhaojh329 committed Jul 7, 2024
1 parent c31608c commit 7607db9
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 7607db9

Please sign in to comment.