Skip to content

Commit 860ffb0

Browse files
committed
Convert many object types structs to use C99 tagged initializer syntax.
1 parent 12e2656 commit 860ffb0

27 files changed

+73
-147
lines changed

py/objbool.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const mp_obj_type_t bool_type = {
4141
NULL, // binary_op
4242
NULL, // getiter
4343
NULL, // iternext
44-
{{NULL, NULL},}, // method list
44+
.methods = {{NULL, NULL},},
4545
};
4646

4747
static const mp_obj_bool_t false_obj = {{&bool_type}, false};

py/objboundmeth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const mp_obj_type_t bound_meth_type = {
4343
NULL, // binary_op
4444
NULL, // getiter
4545
NULL, // iternext
46-
{{NULL, NULL},}, // method list
46+
.methods = {{NULL, NULL},},
4747
};
4848

4949
mp_obj_t mp_obj_new_bound_meth(mp_obj_t self, mp_obj_t meth) {

py/objcell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const mp_obj_type_t cell_type = {
3333
NULL, // binary_op
3434
NULL, // getiter
3535
NULL, // iternext
36-
{{NULL, NULL},}, // method list
36+
.methods = {{NULL, NULL},},
3737
};
3838

3939
mp_obj_t mp_obj_new_cell(mp_obj_t obj) {

py/objclass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const mp_obj_type_t class_type = {
7070
NULL, // binary_op
7171
NULL, // getiter
7272
NULL, // iternext
73-
{{NULL, NULL},}, // method list
73+
.methods = {{NULL, NULL},},
7474
};
7575

7676
mp_obj_t mp_obj_new_class(mp_map_t *class_locals) {

py/objclosure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const mp_obj_type_t closure_type = {
4242
NULL, // binary_op
4343
NULL, // getiter
4444
NULL, // iternext
45-
{{NULL, NULL},}, // method list
45+
.methods = {{NULL, NULL},},
4646
};
4747

4848
mp_obj_t mp_obj_new_closure(mp_obj_t fun, mp_obj_t closure_tuple) {

py/objcomplex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const mp_obj_type_t complex_type = {
125125
complex_binary_op, // binary_op
126126
NULL, // getiter
127127
NULL, // iternext
128-
{ { NULL, NULL }, }, // method list
128+
.methods = { { NULL, NULL }, },
129129
};
130130

131131
mp_obj_t mp_obj_new_complex(mp_float_t real, mp_float_t imag) {

py/objdict.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,11 @@ static mp_obj_t dict_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
6363
const mp_obj_type_t dict_type = {
6464
{ &mp_const_type },
6565
"dict",
66-
dict_print, // print
67-
dict_make_new, // make_new
68-
NULL, // call_n
69-
NULL, // unary_op
70-
dict_binary_op, // binary_op
71-
NULL, // getiter
72-
NULL, // iternext
73-
{{NULL, NULL},}, // method list
66+
.print = dict_print,
67+
.make_new = dict_make_new,
68+
.binary_op = dict_binary_op,
69+
.getiter = NULL,
70+
.methods = {{NULL, NULL},},
7471
};
7572

7673
mp_obj_t mp_obj_new_dict(int n_args) {

py/objexcept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const mp_obj_type_t exception_type = {
4545
NULL, // binary_op
4646
NULL, // getiter
4747
NULL, // iternext
48-
{{NULL, NULL},}, // method list
48+
.methods = {{NULL, NULL},},
4949
};
5050

5151
mp_obj_t mp_obj_new_exception(qstr id) {

py/objfloat.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ static mp_obj_t float_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
7979
const mp_obj_type_t float_type = {
8080
{ &mp_const_type },
8181
"float",
82-
float_print,
83-
float_make_new, // make_new
84-
NULL, // call_n
85-
float_unary_op,
86-
float_binary_op,
87-
NULL, // getiter
88-
NULL, // iternext
89-
{ { NULL, NULL }, }, // method list
82+
.print = float_print,
83+
.make_new = float_make_new,
84+
.unary_op = float_unary_op,
85+
.binary_op = float_binary_op,
86+
.methods = { { NULL, NULL }, },
9087
};
9188

9289
mp_obj_t mp_obj_new_float(mp_float_t value) {

py/objfun.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const mp_obj_type_t fun_native_type = {
7676
NULL, // binary_op
7777
NULL, // getiter
7878
NULL, // iternext
79-
{ // method list
79+
.methods = {
8080
{NULL, NULL}, // end-of-list sentinel
8181
},
8282
};
@@ -169,7 +169,7 @@ const mp_obj_type_t fun_bc_type = {
169169
NULL, // binary_op
170170
NULL, // getiter
171171
NULL, // iternext
172-
{ // method list
172+
.methods = {
173173
{NULL, NULL}, // end-of-list sentinel
174174
},
175175
};
@@ -283,7 +283,7 @@ static const mp_obj_type_t fun_asm_type = {
283283
NULL, // binary_op
284284
NULL, // getiter
285285
NULL, // iternext
286-
{ // method list
286+
.methods = {
287287
{NULL, NULL}, // end-of-list sentinel
288288
},
289289
};

0 commit comments

Comments
 (0)