summaryrefslogtreecommitdiffstatshomepage
path: root/py/malloc.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2020-02-27 15:36:53 +1100
committerDamien George <damien.p.george@gmail.com>2020-02-28 10:33:03 +1100
commit69661f3343bedf86e514337cff63d96cc42f8859 (patch)
treeaf5dfb380ffdb75dda84828f63cf9d840d992f0f /py/malloc.c
parent3f39d18c2b884d32f0443e2e8114ff9d7a14d718 (diff)
downloadmicropython-69661f3343bedf86e514337cff63d96cc42f8859.tar.gz
micropython-69661f3343bedf86e514337cff63d96cc42f8859.zip
all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
Diffstat (limited to 'py/malloc.c')
-rw-r--r--py/malloc.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/py/malloc.c b/py/malloc.c
index f5d82b4c87..c775d5b157 100644
--- a/py/malloc.c
+++ b/py/malloc.c
@@ -87,22 +87,22 @@ void *m_malloc(size_t num_bytes) {
if (ptr == NULL && num_bytes != 0) {
m_malloc_fail(num_bytes);
}
-#if MICROPY_MEM_STATS
+ #if MICROPY_MEM_STATS
MP_STATE_MEM(total_bytes_allocated) += num_bytes;
MP_STATE_MEM(current_bytes_allocated) += num_bytes;
UPDATE_PEAK();
-#endif
+ #endif
DEBUG_printf("malloc %d : %p\n", num_bytes, ptr);
return ptr;
}
void *m_malloc_maybe(size_t num_bytes) {
void *ptr = malloc(num_bytes);
-#if MICROPY_MEM_STATS
+ #if MICROPY_MEM_STATS
MP_STATE_MEM(total_bytes_allocated) += num_bytes;
MP_STATE_MEM(current_bytes_allocated) += num_bytes;
UPDATE_PEAK();
-#endif
+ #endif
DEBUG_printf("malloc %d : %p\n", num_bytes, ptr);
return ptr;
}
@@ -113,11 +113,11 @@ void *m_malloc_with_finaliser(size_t num_bytes) {
if (ptr == NULL && num_bytes != 0) {
m_malloc_fail(num_bytes);
}
-#if MICROPY_MEM_STATS
+ #if MICROPY_MEM_STATS
MP_STATE_MEM(total_bytes_allocated) += num_bytes;
MP_STATE_MEM(current_bytes_allocated) += num_bytes;
UPDATE_PEAK();
-#endif
+ #endif
DEBUG_printf("malloc %d : %p\n", num_bytes, ptr);
return ptr;
}
@@ -142,7 +142,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes)
if (new_ptr == NULL && new_num_bytes != 0) {
m_malloc_fail(new_num_bytes);
}
-#if MICROPY_MEM_STATS
+ #if MICROPY_MEM_STATS
// At first thought, "Total bytes allocated" should only grow,
// after all, it's *total*. But consider for example 2K block
// shrunk to 1K and then grown to 2K again. It's still 2K
@@ -152,7 +152,7 @@ void *m_realloc(void *ptr, size_t new_num_bytes)
MP_STATE_MEM(total_bytes_allocated) += diff;
MP_STATE_MEM(current_bytes_allocated) += diff;
UPDATE_PEAK();
-#endif
+ #endif
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
DEBUG_printf("realloc %p, %d, %d : %p\n", ptr, old_num_bytes, new_num_bytes, new_ptr);
#else
@@ -168,7 +168,7 @@ 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
+ #if MICROPY_MEM_STATS
// At first thought, "Total bytes allocated" should only grow,
// after all, it's *total*. But consider for example 2K block
// shrunk to 1K and then grown to 2K again. It's still 2K
@@ -181,7 +181,7 @@ void *m_realloc_maybe(void *ptr, size_t new_num_bytes, bool allow_move)
MP_STATE_MEM(current_bytes_allocated) += diff;
UPDATE_PEAK();
}
-#endif
+ #endif
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
DEBUG_printf("realloc %p, %d, %d : %p\n", ptr, old_num_bytes, new_num_bytes, new_ptr);
#else
@@ -197,9 +197,9 @@ void m_free(void *ptr)
#endif
{
free(ptr);
-#if MICROPY_MEM_STATS
+ #if MICROPY_MEM_STATS
MP_STATE_MEM(current_bytes_allocated) -= num_bytes;
-#endif
+ #endif
#if MICROPY_MALLOC_USES_ALLOCATED_SIZE
DEBUG_printf("free %p, %d\n", ptr, num_bytes);
#else