@@ -29,14 +29,14 @@ typedef struct _mp_obj_array_t {
29
29
void * items ;
30
30
} mp_obj_array_t ;
31
31
32
- static mp_obj_t array_iterator_new (mp_obj_t array_in );
33
- static mp_obj_array_t * array_new (char typecode , uint n );
34
- static mp_obj_t array_append (mp_obj_t self_in , mp_obj_t arg );
32
+ STATIC mp_obj_t array_iterator_new (mp_obj_t array_in );
33
+ STATIC mp_obj_array_t * array_new (char typecode , uint n );
34
+ STATIC mp_obj_t array_append (mp_obj_t self_in , mp_obj_t arg );
35
35
36
36
/******************************************************************************/
37
37
/* array */
38
38
39
- static machine_int_t array_get_el_size (char typecode ) {
39
+ STATIC machine_int_t array_get_el_size (char typecode ) {
40
40
// This assumes that unsigned and signed types are of the same type,
41
41
// which is invariant for [u]intN_t.
42
42
switch (typecode ) {
@@ -57,7 +57,7 @@ static machine_int_t array_get_el_size(char typecode) {
57
57
return -1 ;
58
58
}
59
59
60
- static machine_int_t array_get_el (mp_obj_array_t * o , int index ) {
60
+ STATIC machine_int_t array_get_el (mp_obj_array_t * o , int index ) {
61
61
machine_int_t val = 0 ;
62
62
switch (o -> typecode ) {
63
63
case 'b' :
@@ -89,7 +89,7 @@ static machine_int_t array_get_el(mp_obj_array_t *o, int index) {
89
89
return val ;
90
90
}
91
91
92
- static void array_set_el (mp_obj_array_t * o , int index , mp_obj_t val_in ) {
92
+ STATIC void array_set_el (mp_obj_array_t * o , int index , mp_obj_t val_in ) {
93
93
machine_int_t val = mp_obj_int_get (val_in );
94
94
switch (o -> typecode ) {
95
95
case 'b' :
@@ -121,7 +121,7 @@ static void array_set_el(mp_obj_array_t *o, int index, mp_obj_t val_in) {
121
121
}
122
122
123
123
124
- static void array_print (void (* print )(void * env , const char * fmt , ...), void * env , mp_obj_t o_in , mp_print_kind_t kind ) {
124
+ STATIC void array_print (void (* print )(void * env , const char * fmt , ...), void * env , mp_obj_t o_in , mp_print_kind_t kind ) {
125
125
mp_obj_array_t * o = o_in ;
126
126
if (o -> typecode == BYTEARRAY_TYPECODE ) {
127
127
print (env , "bytearray(b" , o -> typecode );
@@ -142,7 +142,7 @@ static void array_print(void (*print)(void *env, const char *fmt, ...), void *en
142
142
print (env , ")" );
143
143
}
144
144
145
- static mp_obj_t array_construct (char typecode , mp_obj_t initializer ) {
145
+ STATIC mp_obj_t array_construct (char typecode , mp_obj_t initializer ) {
146
146
uint len ;
147
147
// Try to create array of exact len if initializer len is known
148
148
mp_obj_t len_in = mp_obj_len_maybe (initializer );
@@ -168,7 +168,7 @@ static mp_obj_t array_construct(char typecode, mp_obj_t initializer) {
168
168
return array ;
169
169
}
170
170
171
- static mp_obj_t array_make_new (mp_obj_t type_in , uint n_args , uint n_kw , const mp_obj_t * args ) {
171
+ STATIC mp_obj_t array_make_new (mp_obj_t type_in , uint n_args , uint n_kw , const mp_obj_t * args ) {
172
172
if (n_args < 1 || n_args > 2 ) {
173
173
nlr_jump (mp_obj_new_exception_msg_varg (MP_QSTR_TypeError , "unexpected # of arguments, %d given" , n_args ));
174
174
}
@@ -184,12 +184,12 @@ static mp_obj_t array_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const m
184
184
185
185
// This is top-level factory function, not virtual method
186
186
// TODO: "bytearray" really should be type, not function
187
- static mp_obj_t mp_builtin_bytearray (mp_obj_t arg ) {
187
+ STATIC mp_obj_t mp_builtin_bytearray (mp_obj_t arg ) {
188
188
return array_construct (BYTEARRAY_TYPECODE , arg );
189
189
}
190
190
MP_DEFINE_CONST_FUN_OBJ_1 (mp_builtin_bytearray_obj , mp_builtin_bytearray );
191
191
192
- static mp_obj_t array_unary_op (int op , mp_obj_t o_in ) {
192
+ STATIC mp_obj_t array_unary_op (int op , mp_obj_t o_in ) {
193
193
mp_obj_array_t * o = o_in ;
194
194
switch (op ) {
195
195
case RT_UNARY_OP_BOOL : return MP_BOOL (o -> len != 0 );
@@ -198,7 +198,7 @@ static mp_obj_t array_unary_op(int op, mp_obj_t o_in) {
198
198
}
199
199
}
200
200
201
- static mp_obj_t array_binary_op (int op , mp_obj_t lhs , mp_obj_t rhs ) {
201
+ STATIC mp_obj_t array_binary_op (int op , mp_obj_t lhs , mp_obj_t rhs ) {
202
202
mp_obj_array_t * o = lhs ;
203
203
switch (op ) {
204
204
case RT_BINARY_OP_SUBSCR :
@@ -214,7 +214,7 @@ static mp_obj_t array_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) {
214
214
}
215
215
}
216
216
217
- static mp_obj_t array_append (mp_obj_t self_in , mp_obj_t arg ) {
217
+ STATIC mp_obj_t array_append (mp_obj_t self_in , mp_obj_t arg ) {
218
218
assert (MP_OBJ_IS_TYPE (self_in , & array_type ));
219
219
mp_obj_array_t * self = self_in ;
220
220
if (self -> free == 0 ) {
@@ -227,23 +227,23 @@ static mp_obj_t array_append(mp_obj_t self_in, mp_obj_t arg) {
227
227
self -> free -- ;
228
228
return mp_const_none ; // return None, as per CPython
229
229
}
230
- static MP_DEFINE_CONST_FUN_OBJ_2 (array_append_obj , array_append ) ;
230
+ STATIC MP_DEFINE_CONST_FUN_OBJ_2 (array_append_obj , array_append );
231
231
232
- static bool array_store_item (mp_obj_t self_in , mp_obj_t index_in , mp_obj_t value ) {
232
+ STATIC bool array_store_item (mp_obj_t self_in , mp_obj_t index_in , mp_obj_t value ) {
233
233
mp_obj_array_t * o = self_in ;
234
234
uint index = mp_get_index (o -> base .type , o -> len , index_in );
235
235
array_set_el (o , index , value );
236
236
return true;
237
237
}
238
238
239
- static machine_int_t array_get_buffer (mp_obj_t o_in , buffer_info_t * bufinfo , int flags ) {
239
+ STATIC machine_int_t array_get_buffer (mp_obj_t o_in , buffer_info_t * bufinfo , int flags ) {
240
240
mp_obj_array_t * o = o_in ;
241
241
bufinfo -> buf = o -> items ;
242
242
bufinfo -> len = o -> len * array_get_el_size (o -> typecode );
243
243
return 0 ;
244
244
}
245
245
246
- static const mp_method_t array_type_methods [] = {
246
+ STATIC const mp_method_t array_type_methods [] = {
247
247
{ "append" , & array_append_obj },
248
248
{ NULL , NULL },
249
249
};
@@ -261,7 +261,7 @@ const mp_obj_type_t array_type = {
261
261
.buffer_p = { .get_buffer = array_get_buffer },
262
262
};
263
263
264
- static mp_obj_array_t * array_new (char typecode , uint n ) {
264
+ STATIC mp_obj_array_t * array_new (char typecode , uint n ) {
265
265
mp_obj_array_t * o = m_new_obj (mp_obj_array_t );
266
266
o -> base .type = & array_type ;
267
267
o -> typecode = typecode ;
@@ -311,7 +311,7 @@ mp_obj_t array_it_iternext(mp_obj_t self_in) {
311
311
}
312
312
}
313
313
314
- static const mp_obj_type_t array_it_type = {
314
+ STATIC const mp_obj_type_t array_it_type = {
315
315
{ & mp_const_type },
316
316
"array_iterator" ,
317
317
.iternext = array_it_iternext ,
0 commit comments