Skip to content

Commit

Permalink
Sync umm_malloc style with upstream (#8426)
Browse files Browse the repository at this point in the history
Upstream umm_malloc at git hash id 4dac43c3be7a7470dd669323021ba238081da18e
processed all project files with the style program uncrustify.

This PR updates our ported version of umm_malloc processed with "uncrustify".
This should make subsequent merges of upstream into this port easier.

This also makes the style more consistant through umm_malloc.
  • Loading branch information
mhightower83 authored Jan 3, 2022
1 parent f401f08 commit f26201e
Show file tree
Hide file tree
Showing 12 changed files with 1,432 additions and 1,386 deletions.
28 changes: 28 additions & 0 deletions cores/esp8266/umm_malloc/Notes.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,32 @@ Enhancement ideas:
save on the execution time spent with interrupts disabled.

*/

/*
Dec 29, 2021
Upstream umm_malloc at git hash id 4dac43c3be7a7470dd669323021ba238081da18e
processed all project files with the style program uncrustify.

This PR updates our ported version of umm_malloc processed with "uncrustify".
This should make subsequent merges of upstream into this port easier.

This also makes the style more consistant through umm_malloc.

Some edits to source files was needed to get uncrustify to work.
1) macros with "if"s need to be of the form "if ( blah ) { } " curley braces
are needed for it to parse correctly
2) These "#ifdef __cplusplus" also had to be commented out while running to
avoid parser confusion.
```
#ifdef __cplusplus
extern "C" {
#endif
```
and
```
#ifdef __cplusplus
}
#endif
```
*/
#endif
1 change: 1 addition & 0 deletions cores/esp8266/umm_malloc/dbglog/README.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Downloaded from: https://github.com/rhempel/c-helper-macros/tree/develop
Applied uncrustify to be consistent with the rest of the umm_malloc files.
30 changes: 15 additions & 15 deletions cores/esp8266/umm_malloc/dbglog/dbglog.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,51 +50,51 @@
#undef DBGLOG_FORCE

#ifndef DBGLOG_LEVEL
# define DBGLOG_LEVEL 0
#define DBGLOG_LEVEL 0
#endif

#ifndef DBGLOG_FUNCTION
# define DBGLOG_FUNCTION printf
#define DBGLOG_FUNCTION printf
#endif

#define DBGLOG_32_BIT_PTR(x) ((uint32_t)(((uintptr_t)(x)) & 0xffffffff))

/* ------------------------------------------------------------------------- */

#if DBGLOG_LEVEL >= 6
# define DBGLOG_TRACE(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
#define DBGLOG_TRACE(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
#else
# define DBGLOG_TRACE(format, ...)
#define DBGLOG_TRACE(format, ...)
#endif

#if DBGLOG_LEVEL >= 5
# define DBGLOG_DEBUG(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
#define DBGLOG_DEBUG(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
#else
# define DBGLOG_DEBUG(format, ...)
#define DBGLOG_DEBUG(format, ...)
#endif

#if DBGLOG_LEVEL >= 4
# define DBGLOG_CRITICAL(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
#define DBGLOG_CRITICAL(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
#else
# define DBGLOG_CRITICAL(format, ...)
#define DBGLOG_CRITICAL(format, ...)
#endif

#if DBGLOG_LEVEL >= 3
# define DBGLOG_ERROR(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
#define DBGLOG_ERROR(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
#else
# define DBGLOG_ERROR(format, ...)
#define DBGLOG_ERROR(format, ...)
#endif

#if DBGLOG_LEVEL >= 2
# define DBGLOG_WARNING(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
#define DBGLOG_WARNING(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
#else
# define DBGLOG_WARNING(format, ...)
#define DBGLOG_WARNING(format, ...)
#endif

#if DBGLOG_LEVEL >= 1
# define DBGLOG_INFO(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
#define DBGLOG_INFO(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
#else
# define DBGLOG_INFO(format, ...)
#define DBGLOG_INFO(format, ...)
#endif

#define DBGLOG_FORCE(force, format, ...) {if(force) {DBGLOG_FUNCTION(format, ## __VA_ARGS__);}}
#define DBGLOG_FORCE(force, format, ...) {if (force) {DBGLOG_FUNCTION(format,##__VA_ARGS__);}}
73 changes: 40 additions & 33 deletions cores/esp8266/umm_malloc/umm_heap_select.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,70 +32,77 @@
class HeapSelect {
public:
#if (UMM_NUM_HEAPS == 1)
MAYBE_ALWAYS_INLINE
HeapSelect(size_t id) { (void)id; }
MAYBE_ALWAYS_INLINE
~HeapSelect() {}
MAYBE_ALWAYS_INLINE
HeapSelect(size_t id) {
(void)id;
}
MAYBE_ALWAYS_INLINE
~HeapSelect() {
}
#else
MAYBE_ALWAYS_INLINE
HeapSelect(size_t id) : _heap_id(umm_get_current_heap_id()) {
MAYBE_ALWAYS_INLINE
HeapSelect(size_t id) : _heap_id(umm_get_current_heap_id()) {
umm_set_heap_by_id(id);
}
}

MAYBE_ALWAYS_INLINE
~HeapSelect() {
MAYBE_ALWAYS_INLINE
~HeapSelect() {
umm_set_heap_by_id(_heap_id);
}
}

protected:
size_t _heap_id;
size_t _heap_id;
#endif
};

class HeapSelectIram {
public:
#ifdef UMM_HEAP_IRAM
MAYBE_ALWAYS_INLINE
HeapSelectIram() : _heap_id(umm_get_current_heap_id()) {
MAYBE_ALWAYS_INLINE
HeapSelectIram() : _heap_id(umm_get_current_heap_id()) {
umm_set_heap_by_id(UMM_HEAP_IRAM);
}
}

MAYBE_ALWAYS_INLINE
~HeapSelectIram() {
MAYBE_ALWAYS_INLINE
~HeapSelectIram() {
umm_set_heap_by_id(_heap_id);
}
}

protected:
size_t _heap_id;
size_t _heap_id;

#else
MAYBE_ALWAYS_INLINE
HeapSelectIram() {}
MAYBE_ALWAYS_INLINE
~HeapSelectIram() {}
MAYBE_ALWAYS_INLINE
HeapSelectIram() {
}
MAYBE_ALWAYS_INLINE
~HeapSelectIram() {
}
#endif
};

class HeapSelectDram {
public:
#if (UMM_NUM_HEAPS == 1)
MAYBE_ALWAYS_INLINE
HeapSelectDram() {}
MAYBE_ALWAYS_INLINE
~HeapSelectDram() {}
MAYBE_ALWAYS_INLINE
HeapSelectDram() {
}
MAYBE_ALWAYS_INLINE
~HeapSelectDram() {
}
#else
MAYBE_ALWAYS_INLINE
HeapSelectDram() : _heap_id(umm_get_current_heap_id()) {
MAYBE_ALWAYS_INLINE
HeapSelectDram() : _heap_id(umm_get_current_heap_id()) {
umm_set_heap_by_id(UMM_HEAP_DRAM);
}
}

MAYBE_ALWAYS_INLINE
~HeapSelectDram() {
MAYBE_ALWAYS_INLINE
~HeapSelectDram() {
umm_set_heap_by_id(_heap_id);
}
}

protected:
size_t _heap_id;
size_t _heap_id;
#endif
};

Expand Down
Loading

0 comments on commit f26201e

Please sign in to comment.