summaryrefslogtreecommitdiff
path: root/py/objdeque.c
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2024-02-27 15:32:29 +1100
committerDamien George <damien@micropython.org>2024-03-07 14:20:42 +1100
commitdecf8e6a8bb940d5829ca3296790631fcece7b21 (patch)
tree55b7cd31de14b73e4b72d49344e9084f402767a9 /py/objdeque.c
parentb3f2f18f927fa2fad10daf63d8c391331f5edf58 (diff)
all: Remove the "STATIC" macro and just use "static" instead.
The STATIC macro was introduced a very long time ago in commit d5df6cd44a433d6253a61cb0f987835fbc06b2de. The original reason for this was to have the option to define it to nothing so that all static functions become global functions and therefore visible to certain debug tools, so one could do function size comparison and other things. This STATIC feature is rarely (if ever) used. And with the use of LTO and heavy inline optimisation, analysing the size of individual functions when they are not static is not a good representation of the size of code when fully optimised. So the macro does not have much use and it's simpler to just remove it. Then you know exactly what it's doing. For example, newcomers don't have to learn what the STATIC macro is and why it exists. Reading the code is also less "loud" with a lowercase static. One other minor point in favour of removing it, is that it stops bugs with `STATIC inline`, which should always be `static inline`. Methodology for this commit was: 1) git ls-files | egrep '\.[ch]$' | \ xargs sed -Ei "s/(^| )STATIC($| )/\1static\2/" 2) Do some manual cleanup in the diff by searching for the word STATIC in comments and changing those back. 3) "git-grep STATIC docs/", manually fixed those cases. 4) "rg -t python STATIC", manually fixed codegen lines that used STATIC. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'py/objdeque.c')
-rw-r--r--py/objdeque.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/py/objdeque.c b/py/objdeque.c
index 8b52b8d38..68e162179 100644
--- a/py/objdeque.c
+++ b/py/objdeque.c
@@ -42,7 +42,7 @@ typedef struct _mp_obj_deque_t {
#define FLAG_CHECK_OVERFLOW 1
} mp_obj_deque_t;
-STATIC mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
+static mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
mp_arg_check_num(n_args, n_kw, 2, 3, false);
/* Initialization from existing sequence is not supported, so an empty
@@ -69,7 +69,7 @@ STATIC mp_obj_t deque_make_new(const mp_obj_type_t *type, size_t n_args, size_t
return MP_OBJ_FROM_PTR(o);
}
-STATIC mp_obj_t deque_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
+static mp_obj_t deque_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
switch (op) {
case MP_UNARY_OP_BOOL:
@@ -92,7 +92,7 @@ STATIC mp_obj_t deque_unary_op(mp_unary_op_t op, mp_obj_t self_in) {
}
}
-STATIC mp_obj_t mp_obj_deque_append(mp_obj_t self_in, mp_obj_t arg) {
+static mp_obj_t mp_obj_deque_append(mp_obj_t self_in, mp_obj_t arg) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
size_t new_i_put = self->i_put + 1;
@@ -115,9 +115,9 @@ STATIC mp_obj_t mp_obj_deque_append(mp_obj_t self_in, mp_obj_t arg) {
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_2(deque_append_obj, mp_obj_deque_append);
+static MP_DEFINE_CONST_FUN_OBJ_2(deque_append_obj, mp_obj_deque_append);
-STATIC mp_obj_t deque_popleft(mp_obj_t self_in) {
+static mp_obj_t deque_popleft(mp_obj_t self_in) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
if (self->i_get == self->i_put) {
@@ -133,19 +133,19 @@ STATIC mp_obj_t deque_popleft(mp_obj_t self_in) {
return ret;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(deque_popleft_obj, deque_popleft);
+static MP_DEFINE_CONST_FUN_OBJ_1(deque_popleft_obj, deque_popleft);
#if 0
-STATIC mp_obj_t deque_clear(mp_obj_t self_in) {
+static mp_obj_t deque_clear(mp_obj_t self_in) {
mp_obj_deque_t *self = MP_OBJ_TO_PTR(self_in);
self->i_get = self->i_put = 0;
mp_seq_clear(self->items, 0, self->alloc, sizeof(*self->items));
return mp_const_none;
}
-STATIC MP_DEFINE_CONST_FUN_OBJ_1(deque_clear_obj, deque_clear);
+static MP_DEFINE_CONST_FUN_OBJ_1(deque_clear_obj, deque_clear);
#endif
-STATIC const mp_rom_map_elem_t deque_locals_dict_table[] = {
+static const mp_rom_map_elem_t deque_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_append), MP_ROM_PTR(&deque_append_obj) },
#if 0
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&deque_clear_obj) },
@@ -153,7 +153,7 @@ STATIC const mp_rom_map_elem_t deque_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_popleft), MP_ROM_PTR(&deque_popleft_obj) },
};
-STATIC MP_DEFINE_CONST_DICT(deque_locals_dict, deque_locals_dict_table);
+static MP_DEFINE_CONST_DICT(deque_locals_dict, deque_locals_dict_table);
MP_DEFINE_CONST_OBJ_TYPE(
mp_type_deque,