Skip to content

Commit 0f58236

Browse files
mhightower83hasenradball
authored andcommitted
Sync umm_malloc style with upstream (esp8266#8426)
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.
1 parent 1b673c8 commit 0f58236

12 files changed

+1432
-1386
lines changed

cores/esp8266/umm_malloc/Notes.h

+28
Original file line numberDiff line numberDiff line change
@@ -248,4 +248,32 @@ Enhancement ideas:
248248
save on the execution time spent with interrupts disabled.
249249

250250
*/
251+
252+
/*
253+
Dec 29, 2021
254+
Upstream umm_malloc at git hash id 4dac43c3be7a7470dd669323021ba238081da18e
255+
processed all project files with the style program uncrustify.
256+
257+
This PR updates our ported version of umm_malloc processed with "uncrustify".
258+
This should make subsequent merges of upstream into this port easier.
259+
260+
This also makes the style more consistant through umm_malloc.
261+
262+
Some edits to source files was needed to get uncrustify to work.
263+
1) macros with "if"s need to be of the form "if ( blah ) { } " curley braces
264+
are needed for it to parse correctly
265+
2) These "#ifdef __cplusplus" also had to be commented out while running to
266+
avoid parser confusion.
267+
```
268+
#ifdef __cplusplus
269+
extern "C" {
270+
#endif
271+
```
272+
and
273+
```
274+
#ifdef __cplusplus
275+
}
276+
#endif
277+
```
278+
*/
251279
#endif
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
Downloaded from: https://github.com/rhempel/c-helper-macros/tree/develop
2+
Applied uncrustify to be consistent with the rest of the umm_malloc files.

cores/esp8266/umm_malloc/dbglog/dbglog.h

+15-15
Original file line numberDiff line numberDiff line change
@@ -50,51 +50,51 @@
5050
#undef DBGLOG_FORCE
5151

5252
#ifndef DBGLOG_LEVEL
53-
# define DBGLOG_LEVEL 0
53+
#define DBGLOG_LEVEL 0
5454
#endif
5555

5656
#ifndef DBGLOG_FUNCTION
57-
# define DBGLOG_FUNCTION printf
57+
#define DBGLOG_FUNCTION printf
5858
#endif
5959

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

6262
/* ------------------------------------------------------------------------- */
6363

6464
#if DBGLOG_LEVEL >= 6
65-
# define DBGLOG_TRACE(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
65+
#define DBGLOG_TRACE(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
6666
#else
67-
# define DBGLOG_TRACE(format, ...)
67+
#define DBGLOG_TRACE(format, ...)
6868
#endif
6969

7070
#if DBGLOG_LEVEL >= 5
71-
# define DBGLOG_DEBUG(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
71+
#define DBGLOG_DEBUG(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
7272
#else
73-
# define DBGLOG_DEBUG(format, ...)
73+
#define DBGLOG_DEBUG(format, ...)
7474
#endif
7575

7676
#if DBGLOG_LEVEL >= 4
77-
# define DBGLOG_CRITICAL(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
77+
#define DBGLOG_CRITICAL(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
7878
#else
79-
# define DBGLOG_CRITICAL(format, ...)
79+
#define DBGLOG_CRITICAL(format, ...)
8080
#endif
8181

8282
#if DBGLOG_LEVEL >= 3
83-
# define DBGLOG_ERROR(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
83+
#define DBGLOG_ERROR(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
8484
#else
85-
# define DBGLOG_ERROR(format, ...)
85+
#define DBGLOG_ERROR(format, ...)
8686
#endif
8787

8888
#if DBGLOG_LEVEL >= 2
89-
# define DBGLOG_WARNING(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
89+
#define DBGLOG_WARNING(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
9090
#else
91-
# define DBGLOG_WARNING(format, ...)
91+
#define DBGLOG_WARNING(format, ...)
9292
#endif
9393

9494
#if DBGLOG_LEVEL >= 1
95-
# define DBGLOG_INFO(format, ...) DBGLOG_FUNCTION(format, ## __VA_ARGS__)
95+
#define DBGLOG_INFO(format, ...) DBGLOG_FUNCTION(format,##__VA_ARGS__)
9696
#else
97-
# define DBGLOG_INFO(format, ...)
97+
#define DBGLOG_INFO(format, ...)
9898
#endif
9999

100-
#define DBGLOG_FORCE(force, format, ...) {if(force) {DBGLOG_FUNCTION(format, ## __VA_ARGS__);}}
100+
#define DBGLOG_FORCE(force, format, ...) {if (force) {DBGLOG_FUNCTION(format,##__VA_ARGS__);}}

cores/esp8266/umm_malloc/umm_heap_select.h

+40-33
Original file line numberDiff line numberDiff line change
@@ -32,70 +32,77 @@
3232
class HeapSelect {
3333
public:
3434
#if (UMM_NUM_HEAPS == 1)
35-
MAYBE_ALWAYS_INLINE
36-
HeapSelect(size_t id) { (void)id; }
37-
MAYBE_ALWAYS_INLINE
38-
~HeapSelect() {}
35+
MAYBE_ALWAYS_INLINE
36+
HeapSelect(size_t id) {
37+
(void)id;
38+
}
39+
MAYBE_ALWAYS_INLINE
40+
~HeapSelect() {
41+
}
3942
#else
40-
MAYBE_ALWAYS_INLINE
41-
HeapSelect(size_t id) : _heap_id(umm_get_current_heap_id()) {
43+
MAYBE_ALWAYS_INLINE
44+
HeapSelect(size_t id) : _heap_id(umm_get_current_heap_id()) {
4245
umm_set_heap_by_id(id);
43-
}
46+
}
4447

45-
MAYBE_ALWAYS_INLINE
46-
~HeapSelect() {
48+
MAYBE_ALWAYS_INLINE
49+
~HeapSelect() {
4750
umm_set_heap_by_id(_heap_id);
48-
}
51+
}
4952

5053
protected:
51-
size_t _heap_id;
54+
size_t _heap_id;
5255
#endif
5356
};
5457

5558
class HeapSelectIram {
5659
public:
5760
#ifdef UMM_HEAP_IRAM
58-
MAYBE_ALWAYS_INLINE
59-
HeapSelectIram() : _heap_id(umm_get_current_heap_id()) {
61+
MAYBE_ALWAYS_INLINE
62+
HeapSelectIram() : _heap_id(umm_get_current_heap_id()) {
6063
umm_set_heap_by_id(UMM_HEAP_IRAM);
61-
}
64+
}
6265

63-
MAYBE_ALWAYS_INLINE
64-
~HeapSelectIram() {
66+
MAYBE_ALWAYS_INLINE
67+
~HeapSelectIram() {
6568
umm_set_heap_by_id(_heap_id);
66-
}
69+
}
6770

6871
protected:
69-
size_t _heap_id;
72+
size_t _heap_id;
7073

7174
#else
72-
MAYBE_ALWAYS_INLINE
73-
HeapSelectIram() {}
74-
MAYBE_ALWAYS_INLINE
75-
~HeapSelectIram() {}
75+
MAYBE_ALWAYS_INLINE
76+
HeapSelectIram() {
77+
}
78+
MAYBE_ALWAYS_INLINE
79+
~HeapSelectIram() {
80+
}
7681
#endif
7782
};
7883

7984
class HeapSelectDram {
8085
public:
8186
#if (UMM_NUM_HEAPS == 1)
82-
MAYBE_ALWAYS_INLINE
83-
HeapSelectDram() {}
84-
MAYBE_ALWAYS_INLINE
85-
~HeapSelectDram() {}
87+
MAYBE_ALWAYS_INLINE
88+
HeapSelectDram() {
89+
}
90+
MAYBE_ALWAYS_INLINE
91+
~HeapSelectDram() {
92+
}
8693
#else
87-
MAYBE_ALWAYS_INLINE
88-
HeapSelectDram() : _heap_id(umm_get_current_heap_id()) {
94+
MAYBE_ALWAYS_INLINE
95+
HeapSelectDram() : _heap_id(umm_get_current_heap_id()) {
8996
umm_set_heap_by_id(UMM_HEAP_DRAM);
90-
}
97+
}
9198

92-
MAYBE_ALWAYS_INLINE
93-
~HeapSelectDram() {
99+
MAYBE_ALWAYS_INLINE
100+
~HeapSelectDram() {
94101
umm_set_heap_by_id(_heap_id);
95-
}
102+
}
96103

97104
protected:
98-
size_t _heap_id;
105+
size_t _heap_id;
99106
#endif
100107
};
101108

0 commit comments

Comments
 (0)