8000 fix: Remove redundant indirections · phires/lv_binding_micropython@d6e5be5 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6e5be5

Browse files
committed
fix: Remove redundant indirections
mp_obj is a pointer, no need to use mp_obj* unless that's an array or mp_obj
1 parent a957e7b commit d6e5be5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

gen/gen_mpy.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ class MissingConversionException(ValueError):
759759
STATIC mp_int_t mp_lv_obj_get_buffer(mp_obj_t self_in, mp_buffer_info_t *bufinfo, mp_uint_t flags){ return 0; }
760760
#endif
761761
762-
STATIC mp_obj_t get_native_obj(mp_obj_t *mp_obj)
762+
STATIC mp_obj_t get_native_obj(mp_obj_t mp_obj)
763763
{
764764
if (!MP_OBJ_IS_OBJ(mp_obj)) return mp_obj;
765765
const mp_obj_type_t *native_type = ((mp_obj_base_t*)mp_obj)->type;
@@ -780,9 +780,9 @@ class MissingConversionException(ValueError):
780780
size_t n_kw,
781781
const mp_obj_t *args);
782782
783-
STATIC mp_obj_t *cast(mp_obj_t *mp_obj, const mp_obj_type_t *mp_type)
783+
STATIC mp_obj_t cast(mp_obj_t mp_obj, const mp_obj_type_t *mp_type)
784784
{
785-
mp_obj_t *res = NULL;
785+
mp_obj_t res = NULL;
786786
if (mp_obj == mp_const_none && mp_type->make_new == &make_new_lv_struct) {
787787
res = MP_OBJ_FROM_PTR(&mp_lv_null_obj);
788788
} else if (MP_OBJ_IS_OBJ(mp_obj)) {
@@ -814,7 +814,7 @@ class MissingConversionException(ValueError):
814814
LV_OBJ_T *callbacks;
815815
} mp_lv_obj_t;
816816
817-
STATIC inline LV_OBJ_T *mp_to_lv(mp_obj_t *mp_obj)
817+
STATIC inline LV_OBJ_T *mp_to_lv(mp_obj_t mp_obj)
818818
{
819819
if (mp_obj == NULL || mp_obj == mp_const_none) return NULL;
820820
mp_obj_t native_obj = get_native_obj(mp_obj);
@@ -854,7 +854,7 @@ class MissingConversionException(ValueError):
854854
}
855855
}
856856
857-
STATIC inline mp_obj_t *lv_to_mp(LV_OBJ_T *lv_obj)
857+
STATIC inline mp_obj_t lv_to_mp(LV_OBJ_T *lv_obj)
858858
{
859859
if (lv_obj == NULL) return mp_const_none;
860860
mp_lv_obj_t *self = (mp_lv_obj_t*)lv_obj->user_data;
@@ -1000,7 +1000,7 @@ class MissingConversionException(ValueError):
10001000
STATIC inline mp_lv_struct_t *mp_to_lv_struct(mp_obj_t mp_obj)
10011001
{
10021002
if (mp_obj == NULL || mp_obj == mp_const_none) return NULL;
1003-< 82E8 div class="diff-text-inner"> mp_obj_t *native_obj = get_native_obj(mp_obj);
1003+
mp_obj_t native_obj = get_native_obj(mp_obj);
10041004
if ( (!MP_OBJ_IS_OBJ(native_obj)) || (mp_obj_get_type(native_obj)->make_new != &make_new_lv_struct) ) nlr_raise(
10051005
mp_obj_new_exception_msg(
10061006
&mp_type_SyntaxError, MP_ERROR_TEXT("Expected Struct object!")));
@@ -1139,7 +1139,7 @@ class MissingConversionException(ValueError):
11391139
STATIC mp_obj_t dict_to_struct(mp_obj_t dict, const mp_obj_type_t *type)
11401140
{
11411141
mp_obj_t mp_struct = make_new_lv_struct(type, 0, 0, NULL);
1142-
mp_obj_t *native_dict = cast(dict, &mp_type_dict);
1142+
mp_obj_t native_dict = cast(dict, &mp_type_dict);
11431143
mp_map_t *map = mp_obj_dict_get_map(native_dict);
11441144
if (map == NULL) return mp_const_none;
11451145
for (uint i = 0; i < map->alloc; i++) {

0 commit comments

Comments
 (0)
0