diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-18 10:38:49 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2018-02-18 10:38:49 -0300 |
commit | 8c653212c0e6d15997e4217a514301f5682a41c4 (patch) | |
tree | 53c72812eebbb69c212183cb77db8051731f63c2 /MainPanel.h | |
parent | b064d501ae68a20f519064662205905dbe9f9b85 (diff) |
Replace size_t with int/void* union
I was occasionally passing negative values to size_t.
Plus, this better reflects the intent of the variant argument.
Reported by Coverity:
https://scan8.coverity.com/reports.htm#v13253/p10402/fileInstanceId=22093891&defectInstanceId=7543346&mergedDefectId=174179&fileStart=251&fileEnd=500
Diffstat (limited to 'MainPanel.h')
-rw-r--r-- | MainPanel.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/MainPanel.h b/MainPanel.h index f4671f33..88496597 100644 --- a/MainPanel.h +++ b/MainPanel.h @@ -21,7 +21,12 @@ typedef struct MainPanel_ { pid_t pidSearch; } MainPanel; -typedef bool(*MainPanel_ForeachProcessFn)(Process*, size_t); +typedef union { + int i; + void* v; +} Arg; + +typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg); #define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar) @@ -34,7 +39,7 @@ int MainPanel_selectedPid(MainPanel* this); const char* MainPanel_getValue(MainPanel* this, int i); -bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, size_t arg, bool* wasAnyTagged); +bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged); extern PanelClass MainPanel_class; |