aboutsummaryrefslogtreecommitdiff
path: root/py/malloc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-27 12:34:05 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-28 10:30:29 +1100
commit7768a8c38d7d4e6655d750dbb140558cea48e1d6 (patch)
tree1aa2adb131cce37ebe25596fb94cc56f722ff912 /py/malloc.c
parent73670ef281ed6f63c7b6759e68956a46d86d1df2 (diff)
py/malloc: Put { on separate line for funcs that have selective sigs.
To ensure there are balanced {}'s in the file, and to help with formatting.
Diffstat (limited to 'py/malloc.c')
-rw-r--r--py/malloc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/py/malloc.c b/py/malloc.c
index f8ed1487a..f5d82b4c8 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -133,10 +133,11 @@ void *m_malloc0(size_t num_bytes) {
}
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
-void *m_realloc(void *ptr, size_t old_num_bytes, size_t new_num_bytes) {
+void *m_realloc(void *ptr, size_t old_num_bytes, size_t new_num_bytes)
#else
-void *m_realloc(void *ptr, size_t new_num_bytes) {
+void *m_realloc(void *ptr, size_t new_num_bytes)
#endif
+{
void *new_ptr = realloc(ptr, new_num_bytes);
if (new_ptr == NULL && new_num_bytes != 0) {
m_malloc_fail(new_num_bytes);
@@ -161,10 +162,11 @@ void *m_realloc(void *ptr, size_t new_num_bytes) {
}
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
-void *m_realloc_maybe(void *ptr, size_t old_num_bytes, size_t new_num_bytes, bool allow_move) {
+void *m_realloc_maybe(void *ptr, size_t old_num_bytes, size_t new_num_bytes, bool allow_move)
#else
-void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move) {
+void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move)
#endif
+{
void *new_ptr = realloc_ext(ptr, new_num_bytes, allow_move);
#if MICROPY_MEM_STATS
// At first thought, "Total bytes allocated" should only grow,
@@ -189,10 +191,11 @@ void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move) {
}
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
-void m_free(void *ptr, size_t num_bytes) {
+void m_free(void *ptr, size_t num_bytes)
#else
-void m_free(void *ptr) {
+void m_free(void *ptr)
#endif
+{
free(ptr);
#if MICROPY_MEM_STATS
MP_STATE_MEM(current_bytes_allocated) -= num_bytes;