all: Reformat C and Python source code with tools/codeformat.py.

This is run with uncrustify 0.70.1, and black 19.10b0.
This commit is contained in:
Damien George
2020-02-27 15:36:53 +11:00
parent 3f39d18c2b
commit 69661f3343
539 changed files with 10496 additions and 8254 deletions

View File

@@ -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