Skip to content

Commit ab5a94d

Browse files
committed
fixe types, fix names
1 parent fc96312 commit ab5a94d

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

cores/esp8266/Esp-frag.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "coredecls.h"
2424
#include "Esp.h"
2525

26-
void EspClass::getHeapStats(uint32_t* free, uint16_t* max, uint8_t* frag)
26+
void EspClass::getHeapStats(uint32_t* hfree, uint16_t* hmax, uint8_t* hfrag)
2727
{
2828
// L2 / Euclidian norm of free block sizes.
2929
// Having getFreeHeap()=sum(hole-size), fragmentation is given by
@@ -32,17 +32,17 @@ void EspClass::getHeapStats(uint32_t* free, uint16_t* max, uint8_t* frag)
3232
umm_info(NULL, 0);
3333
uint8_t block_size = umm_block_size();
3434
uint32_t fh = ummHeapInfo.freeBlocks * block_size;
35-
if (free)
36-
*free = fh;
37-
if (max)
38-
*max = ummHeapInfo.maxFreeContiguousBlocks * block_size;
39-
if (frag)
40-
*frag = 100 - (sqrt32(ummHeapInfo.ummFreeSize2) * 100) / fh;
35+
if (hfree)
36+
*hfree = fh;
37+
if (hmax)
38+
*hmax = ummHeapInfo.maxFreeContiguousBlocks * block_size;
39+
if (hfrag)
40+
*hfrag = 100 - (sqrt32(ummHeapInfo.freeSize2) * 100) / fh;
4141
}
4242

4343
uint8_t EspClass::getHeapFragmentation()
4444
{
45-
uint8_t frag;
46-
getHeapStats(nullptr, nullptr, &frag);
47-
return frag;
45+
uint8_t hfrag;
46+
getHeapStats(nullptr, nullptr, &hfrag);
47+
return hfrag;
4848
}

cores/esp8266/umm_malloc/umm_malloc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,10 @@ void ICACHE_FLASH_ATTR *umm_info( void *ptr, int force ) {
10241024
if( UMM_NBLOCK(blockNo) & UMM_FREELIST_MASK ) {
10251025
++ummHeapInfo.freeEntries;
10261026
ummHeapInfo.freeBlocks += curBlocks;
1027-
ummHeapInfo.ummFreeSize2 += (uint32_t)curBlocks * (uint32_t)sizeof(umm_block) * (uint32_t)curBlocks * (uint32_t)sizeof(umm_block);
1027+
ummHeapInfo.freeSize2 += (unsigned int)curBlocks
1028+
* (unsigned int)sizeof(umm_block)
1029+
* (unsigned int)curBlocks
1030+
* (unsigned int)sizeof(umm_block);
10281031

10291032
if (ummHeapInfo.maxFreeContiguousBlocks < curBlocks) {
10301033
ummHeapInfo.maxFreeContiguousBlocks = curBlocks;
@@ -1762,7 +1765,7 @@ size_t ICACHE_FLASH_ATTR umm_free_heap_size( void ) {
17621765
return (size_t)ummHeapInfo.freeBlocks * sizeof(umm_block);
17631766
}
17641767

1765-
uint16_t ICACHE_FLASH_ATTR umm_max_block_size( void ) {
1768+
size_t ICACHE_FLASH_ATTR umm_max_block_size( void ) {
17661769
umm_info(NULL, 0);
17671770
return ummHeapInfo.maxFreeContiguousBlocks * sizeof(umm_block);
17681771
}

cores/esp8266/umm_malloc/umm_malloc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef struct UMM_HEAP_INFO_t {
2727

2828
unsigned short int maxFreeContiguousBlocks;
2929

30-
uint32_t ummFreeSize2;
30+
unsigned int freeSize2;
3131
}
3232
UMM_HEAP_INFO;
3333

@@ -43,8 +43,8 @@ void *umm_realloc( void *ptr, size_t size );
4343
void umm_free( void *ptr );
4444

4545
size_t umm_free_heap_size( void );
46-
uint16_t umm_max_block_size( void );
47-
size_t umm_block_size ( void );
46+
size_t umm_max_block_size( void );
47+
size_t umm_block_size( void );
4848

4949
#ifdef __cplusplus
5050
}

0 commit comments

Comments
 (0)