Skip to content

Commit ca21aed

Browse files
committed
py: Make m_malloc_fail() have void return type, since it doesn't return.
1 parent 6c9fca2 commit ca21aed

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

py/malloc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ STATIC void *realloc_ext(void *ptr, size_t n_bytes, bool allow_move) {
7474
void *m_malloc(size_t num_bytes) {
7575
void *ptr = malloc(num_bytes);
7676
if (ptr == NULL && num_bytes != 0) {
77-
return m_malloc_fail(num_bytes);
77+
m_malloc_fail(num_bytes);
7878
}
7979
#if MICROPY_MEM_STATS
8080
MP_STATE_MEM(total_bytes_allocated) += num_bytes;
@@ -100,7 +100,7 @@ void *m_malloc_maybe(size_t num_bytes) {
100100
void *m_malloc_with_finaliser(size_t num_bytes) {
101101
void *ptr = malloc_with_finaliser(num_bytes);
102102
if (ptr == NULL && num_bytes != 0) {
103-
return m_malloc_fail(num_bytes);
103+
m_malloc_fail(num_bytes);
104104
}
105105
#if MICROPY_MEM_STATS
106106
MP_STATE_MEM(total_bytes_allocated) += num_bytes;
@@ -115,7 +115,7 @@ void *m_malloc_with_finaliser(size_t num_bytes) {
115115
void *m_malloc0(size_t num_bytes) {
116116
void *ptr = m_malloc(num_bytes);
117117
if (ptr == NULL && num_bytes != 0) {
118-
return m_malloc_fail(num_bytes);
118+
m_malloc_fail(num_bytes);
119119
}
120120
// If this config is set then the GC clears all memory, so we don't need to.
121121
#if !MICROPY_GC_CONSERVATIVE_CLEAR
@@ -131,7 +131,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes) {
131131
#endif
132132
void *new_ptr = realloc(ptr, new_num_bytes);
133133
if (new_ptr == NULL && new_num_bytes != 0) {
134-
return m_malloc_fail(new_num_bytes);
134+
m_malloc_fail(new_num_bytes);
135135
}
136136
#if MICROPY_MEM_STATS
137137
// At first thought, "Total bytes allocated" should only grow,

py/misc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes);
9292
void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move);
9393
void m_free(void *ptr);
9494
#endif
95-
NORETURN void *m_malloc_fail(size_t num_bytes);
95+
NORETURN void m_malloc_fail(size_t num_bytes);
9696

9797
#if MICROPY_MEM_STATS
9898
size_t m_get_total_bytes_allocated(void);

py/runtime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ mp_obj_t mp_parse_compile_execute(mp_lexer_t *lex, mp_parse_input_kind_t parse_i
14081408

14091409
#endif // MICROPY_ENABLE_COMPILER
14101410

1411-
NORETURN void *m_malloc_fail(size_t num_bytes) {
1411+
NORETURN void m_malloc_fail(size_t num_bytes) {
14121412
DEBUG_printf("memory allocation failed, allocating %u bytes\n", (uint)num_bytes);
14131413
#if MICROPY_ENABLE_GC
14141414
if (gc_is_locked()) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy