66#include "detection/swap/swap.h"
77#include "modules/swap/swap.h"
88
9- void printSwap (FFSwapOptions * options , uint8_t index , FFSwapResult * storage ) {
9+ void printSwap (FFSwapOptions * options , uint8_t index , uint32_t totalCount , FFSwapResult * storage ) {
1010 FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate ();
1111
1212 if (options -> moduleArgs .key .length == 0 ) {
@@ -45,7 +45,7 @@ void printSwap(FFSwapOptions* options, uint8_t index, FFSwapResult* storage) {
4545 ffStrbufAppendC (& str , ' ' );
4646 }
4747 if (!(percentType & FF_PERCENTAGE_TYPE_HIDE_OTHERS_BIT )) {
48- ffStrbufAppendS (& str , "Disabled" );
48+ ffStrbufAppendS (& str , totalCount ? "Unused" : "Disabled" );
4949 } else {
5050 ffPercentAppendNum (& str , 0 , options -> percent , str .length > 0 , & options -> moduleArgs );
5151 }
@@ -94,11 +94,11 @@ bool ffPrintSwap(FFSwapOptions* options) {
9494 return false;
9595 }
9696
97- if (options -> separate ) {
97+ if (options -> separate && result . length > 0 ) {
9898 uint8_t index = 0 ;
9999 FF_LIST_FOR_EACH (FFSwapResult , storage , result ) {
100100 ++ index ;
101- printSwap (options , index , storage );
101+ printSwap (options , index , result . length , storage );
102102 }
103103 } else {
104104 FFSwapResult total = {
@@ -108,7 +108,7 @@ bool ffPrintSwap(FFSwapOptions* options) {
108108 total .bytesUsed += storage -> bytesUsed ;
109109 total .bytesTotal += storage -> bytesTotal ;
110110 }
111- printSwap (options , 0 , & total );
111+ printSwap (options , 0 , result . length , & total );
112112 ffStrbufDestroy (& total .name );
113113 }
114114
0 commit comments