Skip to content

Commit 4e24608

Browse files
committed
objstr: Mark few local symbols as static, cleanup codestyle.
Please don't submit patches with tab indentation!
1 parent c0a8374 commit 4e24608

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

py/objstr.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static const byte *find_subbytes(const byte *haystack, uint hlen, const byte *ne
100100
return NULL;
101101
}
102102

103-
mp_obj_t str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
103+
static mp_obj_t str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
104104
GET_STR_DATA_LEN(lhs_in, lhs_data, lhs_len);
105105
switch (op) {
106106
case RT_BINARY_OP_SUBSCR:
@@ -188,7 +188,7 @@ mp_obj_t str_binary_op(int op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
188188
return MP_OBJ_NULL; // op not supported
189189
}
190190

191-
mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
191+
static mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) {
192192
assert(MP_OBJ_IS_STR(self_in));
193193

194194
// get separation string
@@ -329,7 +329,7 @@ static bool chr_in_str(const byte* const str, const size_t str_len, int c) {
329329
return false;
330330
}
331331

332-
mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
332+
static mp_obj_t str_strip(uint n_args, const mp_obj_t *args) {
333333
assert(1 <= n_args && n_args <= 2);
334334
assert(MP_OBJ_IS_STR(args[0]));
335335

@@ -403,20 +403,20 @@ mp_obj_t str_format(uint n_args, const mp_obj_t *args) {
403403
return s;
404404
}
405405

406-
mp_obj_t str_replace(uint n_args, const mp_obj_t *args) {
406+
static mp_obj_t str_replace(uint n_args, const mp_obj_t *args) {
407407
assert(MP_OBJ_IS_STR(args[0]));
408408
assert(MP_OBJ_IS_STR(args[1]));
409409
assert(MP_OBJ_IS_STR(args[2]));
410410

411411
machine_int_t max_rep = 0;
412412
if (n_args == 4) {
413-
assert(MP_OBJ_IS_SMALL_INT(args[3]));
414-
max_rep = MP_OBJ_SMALL_INT_VALUE(args[3]);
415-
if (max_rep == 0) {
416-
return args[0];
417-
} else if (max_rep < 0) {
418-
max_rep = 0;
419-
}
413+
assert(MP_OBJ_IS_SMALL_INT(args[3]));
414+
max_rep = MP_OBJ_SMALL_INT_VALUE(args[3]);
415+
if (max_rep == 0) {
416+
return args[0];
417+
} else if (max_rep < 0) {
418+
max_rep = 0;
419+
}
420420
}
421421

422422
// if max_rep is still 0 by this point we will need to do all possible replacements
@@ -427,7 +427,7 @@ mp_obj_t str_replace(uint n_args, const mp_obj_t *args) {
427427

428428
// old won't exist in str if it's longer, so nothing to replace
429429
if (old_len > str_len) {
430-
return args[0];
430+
return args[0];
431431
}
432432

433433
// data for the replaced string
@@ -654,7 +654,7 @@ typedef struct _mp_obj_str_it_t {
654654
machine_uint_t cur;
655655
} mp_obj_str_it_t;
656656

657-
mp_obj_t str_it_iternext(mp_obj_t self_in) {
657+
static mp_obj_t str_it_iternext(mp_obj_t self_in) {
658658
mp_obj_str_it_t *self = self_in;
659659
GET_STR_DATA_LEN(self->str, str, len);
660660
if (self->cur < len) {
@@ -672,7 +672,7 @@ static const mp_obj_type_t str_it_type = {
672672
.iternext = str_it_iternext,
673673
};
674674

675-
mp_obj_t bytes_it_iternext(mp_obj_t self_in) {
675+
static mp_obj_t bytes_it_iternext(mp_obj_t self_in) {
676676
mp_obj_str_it_t *self = self_in;
677677
GET_STR_DATA_LEN(self->str, str, len);
678678
if (self->cur < len) {

0 commit comments

Comments
 (0)