From 0f5262917fab34b44b43f63946fdf6bb0621875a Mon Sep 17 00:00:00 2001 From: Benny Baumann Date: Sat, 19 Sep 2020 13:55:23 +0200 Subject: [PATCH] Make all required includes explicit Information as seen by IWYU 0.12 + clang 9 on Linux --- Action.c | 22 +++++++------ Action.h | 5 +++ Affinity.c | 3 ++ Affinity.h | 5 +++ AffinityPanel.c | 11 ++++++- AvailableColumnsPanel.c | 9 ++++-- AvailableMetersPanel.c | 19 +++++++---- AvailableMetersPanel.h | 1 + BatteryMeter.c | 13 +++----- CPUMeter.c | 17 ++++++---- CRT.c | 18 +++++------ CRT.h | 6 +++- CategoriesPanel.c | 22 ++++++++----- CategoriesPanel.h | 1 + CheckItem.c | 5 +-- CheckItem.h | 2 ++ ClockMeter.c | 7 ++-- ColorsPanel.c | 14 +++++--- ColumnsPanel.c | 17 ++++++---- ColumnsPanel.h | 2 ++ CommandScreen.c | 15 ++++----- CommandScreen.h | 3 ++ DateMeter.c | 7 ++-- DateTimeMeter.c | 7 ++-- DiskIOMeter.c | 6 +++- DisplayOptionsPanel.c | 9 ++++-- EnvScreen.c | 18 ++++++----- EnvScreen.h | 2 ++ FunctionBar.c | 11 ++++--- Hashtable.h | 5 ++- Header.c | 12 ++++--- Header.h | 1 + HostnameMeter.c | 7 ++-- IncSet.c | 14 +++++--- IncSet.h | 2 ++ InfoScreen.c | 17 +++++----- InfoScreen.h | 24 ++++++++------ ListItem.c | 10 +++--- ListItem.h | 2 ++ LoadAverageMeter.c | 2 ++ Macros.h | 2 ++ MainPanel.c | 14 ++++++-- MainPanel.h | 6 ++++ Makefile.am | 1 + MemoryMeter.c | 8 ++--- Meter.c | 20 +++++++----- Meter.h | 9 ++++-- MetersPanel.c | 8 ++++- MetersPanel.h | 5 +++ NetworkIOMeter.c | 7 ++++ Object.c | 3 ++ Object.h | 6 ++-- OpenFilesScreen.c | 24 +++++++------- OpenFilesScreen.h | 4 +++ Panel.c | 19 ++++++----- Panel.h | 5 +++ Process.c | 37 +++++++++++---------- Process.h | 12 ++++--- ProcessList.c | 9 +++--- ProcessList.h | 8 +++++ ProvideCurses.h | 34 ++++++++++++++++++++ RichString.c | 6 ++-- RichString.h | 18 +---------- ScreenManager.c | 15 +++++---- ScreenManager.h | 3 ++ Settings.c | 12 ++++--- Settings.h | 5 ++- SignalsPanel.c | 9 +++--- SignalsPanel.h | 2 ++ SwapMeter.c | 8 ++--- TasksMeter.c | 6 +++- TraceScreen.c | 34 ++++++++++---------- TraceScreen.h | 2 ++ UptimeMeter.c | 1 + UsersTable.c | 9 ++---- Vector.c | 3 +- Vector.h | 2 ++ XUtils.c | 3 +- XUtils.h | 7 ++-- freebsd/FreeBSDProcess.h | 8 +++++ freebsd/FreeBSDProcessList.c | 25 ++++++++------- freebsd/FreeBSDProcessList.h | 10 ++++-- htop.c | 36 +++++++++++++-------- linux/Battery.c | 10 ++++-- linux/Battery.h | 1 + linux/IOPriorityPanel.c | 6 ++++ linux/IOPriorityPanel.h | 1 - linux/LinuxProcess.c | 20 ++++++------ linux/LinuxProcess.h | 13 ++++++-- linux/LinuxProcessList.c | 62 ++++++++++++++++++++---------------- linux/LinuxProcessList.h | 7 ++++ linux/Platform.c | 51 +++++++++++++++++------------ linux/Platform.h | 8 +++-- linux/PressureStallMeter.c | 4 +++ linux/SELinuxMeter.c | 14 +++++--- zfs/ZfsArcMeter.c | 13 ++------ zfs/ZfsCompressedArcMeter.c | 15 +++------ 97 files changed, 666 insertions(+), 397 deletions(-) create mode 100644 ProvideCurses.h diff --git a/Action.c b/Action.c index f53acf7b..b5bd5b54 100644 --- a/Action.c +++ b/Action.c @@ -8,28 +8,32 @@ in the source distribution for its full text. #include "config.h" #include "Action.h" + +#include +#include +#include + #include "Affinity.h" #include "AffinityPanel.h" #include "CategoriesPanel.h" +#include "CommandScreen.h" #include "CRT.h" #include "EnvScreen.h" -#include "CommandScreen.h" +#include "FunctionBar.h" +#include "IncSet.h" +#include "InfoScreen.h" +#include "ListItem.h" +#include "Macros.h" #include "MainPanel.h" #include "OpenFilesScreen.h" #include "Process.h" +#include "ProvideCurses.h" #include "ScreenManager.h" #include "SignalsPanel.h" #include "TraceScreen.h" -#include "Platform.h" +#include "Vector.h" #include "XUtils.h" -#include -#include -#include -#include -#include -#include -#include Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess) { Panel* panel = st->panel; diff --git a/Action.h b/Action.h index 40300ed4..e63b6810 100644 --- a/Action.h +++ b/Action.h @@ -7,8 +7,13 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include +#include + #include "Header.h" +#include "Object.h" #include "Panel.h" +#include "Process.h" #include "ProcessList.h" #include "Settings.h" #include "UsersTable.h" diff --git a/Affinity.c b/Affinity.c index 852d4d5f..4d78944c 100644 --- a/Affinity.c +++ b/Affinity.c @@ -12,8 +12,11 @@ in the source distribution for its full text. #include +#include "XUtils.h" + #ifdef HAVE_LIBHWLOC #include +#include #ifdef __linux__ #define HTOP_HWLOC_CPUBIND_FLAG HWLOC_CPUBIND_THREAD #else diff --git a/Affinity.h b/Affinity.h index 6d744dde..0797b366 100644 --- a/Affinity.h +++ b/Affinity.h @@ -8,6 +8,11 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" + +#include + +#include "Object.h" #include "Process.h" #include "ProcessList.h" diff --git a/AffinityPanel.c b/AffinityPanel.c index ab17b420..a8cb66ee 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -5,21 +5,30 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "AffinityPanel.h" #include +#include +#include #include #include "CRT.h" +#include "FunctionBar.h" +#include "Object.h" +#include "ProvideCurses.h" +#include "RichString.h" +#include "Settings.h" #include "Vector.h" #include "XUtils.h" #ifdef HAVE_LIBHWLOC #include +#include #endif + typedef struct MaskItem_ { Object super; char* text; diff --git a/AvailableColumnsPanel.c b/AvailableColumnsPanel.c index 32bb470e..feea5786 100644 --- a/AvailableColumnsPanel.c +++ b/AvailableColumnsPanel.c @@ -7,14 +7,17 @@ in the source distribution for its full text. #include "AvailableColumnsPanel.h" -#include #include +#include #include -#include #include "ColumnsPanel.h" -#include "Header.h" +#include "FunctionBar.h" +#include "ListItem.h" +#include "Object.h" #include "Platform.h" +#include "Process.h" +#include "ProvideCurses.h" #include "XUtils.h" diff --git a/AvailableMetersPanel.c b/AvailableMetersPanel.c index faa69a8f..33006e94 100644 --- a/AvailableMetersPanel.c +++ b/AvailableMetersPanel.c @@ -6,17 +6,22 @@ in the source distribution for its full text. */ #include "AvailableMetersPanel.h" -#include "MetersPanel.h" - -#include "CPUMeter.h" -#include "Header.h" -#include "ListItem.h" -#include "Platform.h" -#include "XUtils.h" #include +#include #include +#include "CPUMeter.h" +#include "FunctionBar.h" +#include "Header.h" +#include "ListItem.h" +#include "Meter.h" +#include "MetersPanel.h" +#include "Object.h" +#include "Platform.h" +#include "ProvideCurses.h" +#include "XUtils.h" + static void AvailableMetersPanel_delete(Object* object) { Panel* super = (Panel*) object; diff --git a/AvailableMetersPanel.h b/AvailableMetersPanel.h index f168869d..f7359365 100644 --- a/AvailableMetersPanel.h +++ b/AvailableMetersPanel.h @@ -7,6 +7,7 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "Header.h" #include "Panel.h" #include "ProcessList.h" #include "ScreenManager.h" diff --git a/BatteryMeter.c b/BatteryMeter.c index 22a63c7a..c91ae997 100644 --- a/BatteryMeter.c +++ b/BatteryMeter.c @@ -9,15 +9,12 @@ This meter written by Ian P. Hands (iphands@gmail.com, ihands@redhat.com). #include "BatteryMeter.h" -#include "Battery.h" -#include "ProcessList.h" -#include "CRT.h" -#include "Platform.h" -#include "XUtils.h" - #include -#include -#include + +#include "Battery.h" +#include "CRT.h" +#include "Object.h" +#include "XUtils.h" static const int BatteryMeter_attributes[] = { diff --git a/CPUMeter.c b/CPUMeter.c index 7e70f454..10635478 100644 --- a/CPUMeter.c +++ b/CPUMeter.c @@ -7,15 +7,18 @@ in the source distribution for its full text. #include "CPUMeter.h" -#include "CRT.h" -#include "Settings.h" -#include "Platform.h" -#include "XUtils.h" - -#include +#include #include #include -#include + +#include "CRT.h" +#include "Object.h" +#include "Platform.h" +#include "ProcessList.h" +#include "RichString.h" +#include "Settings.h" +#include "XUtils.h" + static const int CPUMeter_attributes[] = { CPU_NICE, diff --git a/CRT.c b/CRT.c index 2f9eb2b6..d3afd0ec 100644 --- a/CRT.c +++ b/CRT.c @@ -5,28 +5,26 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep + #include "CRT.h" -#include "RichString.h" -#include "XUtils.h" - -#include #include +#include +#include #include +#include #include #include -#include -#include #include +#include "ProvideCurses.h" +#include "XUtils.h" + #ifdef HAVE_EXECINFO_H #include #endif -#ifdef HAVE_SETUID_ENABLED -#include -#endif #define ColorIndex(i,j) ((7-(i))*8+(j)) diff --git a/CRT.h b/CRT.h index fa2f6de7..83cb34e6 100644 --- a/CRT.h +++ b/CRT.h @@ -7,10 +7,14 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Macros.h" +#include "config.h" #include +#include "Macros.h" +#include "ProvideCurses.h" + + typedef enum TreeStr_ { TREE_STR_HORZ, TREE_STR_VERT, diff --git a/CategoriesPanel.c b/CategoriesPanel.c index 8adf14f6..d6c25a69 100644 --- a/CategoriesPanel.c +++ b/CategoriesPanel.c @@ -7,16 +7,22 @@ in the source distribution for its full text. #include "CategoriesPanel.h" -#include "AvailableMetersPanel.h" -#include "MetersPanel.h" -#include "DisplayOptionsPanel.h" -#include "ColumnsPanel.h" -#include "ColorsPanel.h" -#include "AvailableColumnsPanel.h" - -#include +#include +#include #include +#include "AvailableColumnsPanel.h" +#include "AvailableMetersPanel.h" +#include "ColorsPanel.h" +#include "ColumnsPanel.h" +#include "DisplayOptionsPanel.h" +#include "FunctionBar.h" +#include "ListItem.h" +#include "MetersPanel.h" +#include "Object.h" +#include "ProvideCurses.h" +#include "Vector.h" + static const char* const CategoriesFunctions[] = {" ", " ", " ", " ", " ", " ", " ", " ", " ", "Done ", NULL}; diff --git a/CategoriesPanel.h b/CategoriesPanel.h index 1f17bd2e..0582c642 100644 --- a/CategoriesPanel.h +++ b/CategoriesPanel.h @@ -7,6 +7,7 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "Header.h" #include "Panel.h" #include "ProcessList.h" #include "ScreenManager.h" diff --git a/CheckItem.c b/CheckItem.c index d1f11963..5c79ab13 100644 --- a/CheckItem.c +++ b/CheckItem.c @@ -7,11 +7,12 @@ in the source distribution for its full text. #include "CheckItem.h" -#include "CRT.h" - #include #include +#include "CRT.h" +#include "RichString.h" + static void CheckItem_delete(Object* cast) { CheckItem* this = (CheckItem*)cast; diff --git a/CheckItem.h b/CheckItem.h index b4300db4..a357111f 100644 --- a/CheckItem.h +++ b/CheckItem.h @@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "Object.h" typedef struct CheckItem_ { diff --git a/ClockMeter.c b/ClockMeter.c index 51fbed63..c6f2ab33 100644 --- a/ClockMeter.c +++ b/ClockMeter.c @@ -5,12 +5,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "ClockMeter.h" -#include "CRT.h" - #include +#include "CRT.h" +#include "Object.h" + static const int ClockMeter_attributes[] = { CLOCK diff --git a/ColorsPanel.c b/ColorsPanel.c index 5b189ea3..24e63b0e 100644 --- a/ColorsPanel.c +++ b/ColorsPanel.c @@ -7,13 +7,19 @@ in the source distribution for its full text. #include "ColorsPanel.h" -#include "CRT.h" +#include +#include + #include "CheckItem.h" +#include "CRT.h" +#include "FunctionBar.h" +#include "Header.h" +#include "Object.h" +#include "ProvideCurses.h" +#include "RichString.h" +#include "Vector.h" #include "XUtils.h" -#include -#include -#include // TO ADD A NEW SCHEME: // * Increment the size of bool check in ColorsPanel.h diff --git a/ColumnsPanel.c b/ColumnsPanel.c index a0e9fd31..f8250197 100644 --- a/ColumnsPanel.c +++ b/ColumnsPanel.c @@ -6,15 +6,18 @@ in the source distribution for its full text. */ #include "ColumnsPanel.h" -#include "Platform.h" -#include "XUtils.h" -#include "ListItem.h" -#include "CRT.h" - -#include -#include #include +#include + +#include "CRT.h" +#include "FunctionBar.h" +#include "ListItem.h" +#include "Object.h" +#include "Platform.h" +#include "Process.h" +#include "ProvideCurses.h" +#include "XUtils.h" static const char* const ColumnsFunctions[] = {" ", " ", " ", " ", " ", " ", "MoveUp", "MoveDn", "Remove", "Done ", NULL}; diff --git a/ColumnsPanel.h b/ColumnsPanel.h index e8acbb23..68f80450 100644 --- a/ColumnsPanel.h +++ b/ColumnsPanel.h @@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "Panel.h" #include "Settings.h" diff --git a/CommandScreen.c b/CommandScreen.c index df039645..7997a64a 100644 --- a/CommandScreen.c +++ b/CommandScreen.c @@ -1,15 +1,14 @@ -#include "CommandScreen.h" +#include "config.h" // IWYU pragma: keep -#include "config.h" -#include "CRT.h" -#include "IncSet.h" -#include "ListItem.h" -#include "Platform.h" -#include "XUtils.h" +#include "CommandScreen.h" #include #include -#include + +#include "Macros.h" +#include "Panel.h" +#include "ProvideCurses.h" +#include "XUtils.h" static void CommandScreen_scan(InfoScreen* this) { diff --git a/CommandScreen.h b/CommandScreen.h index 4f3ce947..e56982b2 100644 --- a/CommandScreen.h +++ b/CommandScreen.h @@ -2,6 +2,9 @@ #define HEADER_CommandScreen #include "InfoScreen.h" +#include "Object.h" +#include "Process.h" + typedef struct CommandScreen_ { InfoScreen super; diff --git a/DateMeter.c b/DateMeter.c index 6ea108e1..c1a097f6 100644 --- a/DateMeter.c +++ b/DateMeter.c @@ -5,12 +5,15 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "DateMeter.h" -#include "CRT.h" - #include +#include "CRT.h" +#include "Object.h" + static const int DateMeter_attributes[] = { DATE diff --git a/DateTimeMeter.c b/DateTimeMeter.c index f3c877b3..74582191 100644 --- a/DateTimeMeter.c +++ b/DateTimeMeter.c @@ -5,12 +5,15 @@ Released under the GNU GPL, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "DateTimeMeter.h" -#include "CRT.h" - #include +#include "CRT.h" +#include "Object.h" + static const int DateTimeMeter_attributes[] = { DATETIME diff --git a/DiskIOMeter.c b/DiskIOMeter.c index d882b433..432ba6f0 100644 --- a/DiskIOMeter.c +++ b/DiskIOMeter.c @@ -7,10 +7,14 @@ in the source distribution for its full text. #include "DiskIOMeter.h" -#include +#include +#include #include "CRT.h" +#include "Macros.h" +#include "Object.h" #include "Platform.h" +#include "RichString.h" #include "XUtils.h" diff --git a/DisplayOptionsPanel.c b/DisplayOptionsPanel.c index d667ab7f..6fa2d39c 100644 --- a/DisplayOptionsPanel.c +++ b/DisplayOptionsPanel.c @@ -5,14 +5,19 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "DisplayOptionsPanel.h" -#include +#include #include -#include #include "CheckItem.h" #include "CRT.h" +#include "FunctionBar.h" +#include "Header.h" +#include "Object.h" +#include "ProvideCurses.h" #include "XUtils.h" diff --git a/EnvScreen.c b/EnvScreen.c index 10060ec7..cd8e0cb3 100644 --- a/EnvScreen.c +++ b/EnvScreen.c @@ -1,15 +1,17 @@ -#include "EnvScreen.h" +#include "config.h" // IWYU pragma: keep -#include "config.h" -#include "CRT.h" -#include "IncSet.h" -#include "ListItem.h" -#include "Platform.h" -#include "XUtils.h" +#include "EnvScreen.h" #include #include -#include + +#include "CRT.h" +#include "Macros.h" +#include "Panel.h" +#include "Platform.h" +#include "ProvideCurses.h" +#include "Vector.h" +#include "XUtils.h" const InfoScreenClass EnvScreen_class = { diff --git a/EnvScreen.h b/EnvScreen.h index 428a121f..bf385801 100644 --- a/EnvScreen.h +++ b/EnvScreen.h @@ -2,6 +2,8 @@ #define HEADER_EnvScreen #include "InfoScreen.h" +#include "Object.h" +#include "Process.h" typedef struct EnvScreen_ { InfoScreen super; diff --git a/FunctionBar.c b/FunctionBar.c index 50bae0b1..1c4f395b 100644 --- a/FunctionBar.c +++ b/FunctionBar.c @@ -6,13 +6,14 @@ in the source distribution for its full text. */ #include "FunctionBar.h" -#include "CRT.h" -#include "RichString.h" -#include "XUtils.h" -#include -#include #include +#include + +#include "CRT.h" +#include "Macros.h" +#include "ProvideCurses.h" +#include "XUtils.h" static const char* const FunctionBar_FKeys[] = {"F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", NULL}; diff --git a/Hashtable.h b/Hashtable.h index f4262091..dcdc89fe 100644 --- a/Hashtable.h +++ b/Hashtable.h @@ -9,7 +9,6 @@ in the source distribution for its full text. #include -typedef struct Hashtable_ Hashtable; typedef void(*Hashtable_PairFunction)(int, void*, void*); @@ -19,12 +18,12 @@ typedef struct HashtableItem { struct HashtableItem* next; } HashtableItem; -struct Hashtable_ { +typedef struct Hashtable_ { int size; HashtableItem** buckets; int items; bool owner; -}; +} Hashtable; #ifndef NDEBUG diff --git a/Header.c b/Header.c index f5233370..3bb24c23 100644 --- a/Header.c +++ b/Header.c @@ -7,14 +7,18 @@ in the source distribution for its full text. #include "Header.h" +#include +#include +#include +#include + #include "CRT.h" +#include "Macros.h" +#include "Object.h" #include "Platform.h" +#include "ProvideCurses.h" #include "XUtils.h" -#include -#include -#include -#include Header* Header_new(struct ProcessList_* pl, Settings* settings, int nrColumns) { Header* this = xCalloc(1, sizeof(Header)); diff --git a/Header.h b/Header.h index 9059a9f4..f99966c3 100644 --- a/Header.h +++ b/Header.h @@ -8,6 +8,7 @@ in the source distribution for its full text. */ #include "Meter.h" +#include "ProcessList.h" #include "Settings.h" #include "Vector.h" diff --git a/HostnameMeter.c b/HostnameMeter.c index 24424d01..6cf9e07e 100644 --- a/HostnameMeter.c +++ b/HostnameMeter.c @@ -5,12 +5,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "HostnameMeter.h" -#include "CRT.h" - #include +#include "CRT.h" +#include "Object.h" + static const int HostnameMeter_attributes[] = { HOSTNAME diff --git a/IncSet.c b/IncSet.c index 3534f857..0d1aecf5 100644 --- a/IncSet.c +++ b/IncSet.c @@ -5,14 +5,20 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "IncSet.h" -#include "ListItem.h" -#include "CRT.h" -#include "XUtils.h" +#include "config.h" // IWYU pragma: keep +#include "IncSet.h" + +#include #include #include +#include "CRT.h" +#include "ListItem.h" +#include "Object.h" +#include "ProvideCurses.h" +#include "XUtils.h" + static void IncMode_reset(IncMode* mode) { mode->index = 0; diff --git a/IncSet.h b/IncSet.h index f0589747..10b3625c 100644 --- a/IncSet.h +++ b/IncSet.h @@ -8,9 +8,11 @@ in the source distribution for its full text. */ #include +#include #include "FunctionBar.h" #include "Panel.h" +#include "Vector.h" #define INCMODE_MAX 40 diff --git a/InfoScreen.c b/InfoScreen.c index ed890f7d..0c666234 100644 --- a/InfoScreen.c +++ b/InfoScreen.c @@ -1,18 +1,19 @@ +#include "config.h" // IWYU pragma: keep + #include "InfoScreen.h" -#include "config.h" -#include "Object.h" +#include +#include +#include +#include + #include "CRT.h" #include "IncSet.h" #include "ListItem.h" -#include "Platform.h" +#include "Object.h" +#include "ProvideCurses.h" #include "XUtils.h" -#include -#include -#include -#include - static const char* const InfoScreenFunctions[] = {"Search ", "Filter ", "Refresh", "Done ", NULL}; diff --git a/InfoScreen.h b/InfoScreen.h index 79927c47..0d80367d 100644 --- a/InfoScreen.h +++ b/InfoScreen.h @@ -1,12 +1,25 @@ #ifndef HEADER_InfoScreen #define HEADER_InfoScreen +#include + #include "FunctionBar.h" #include "IncSet.h" +#include "Macros.h" +#include "Object.h" #include "Panel.h" #include "Process.h" +#include "Vector.h" -typedef struct InfoScreen_ InfoScreen; + +typedef struct InfoScreen_ { + Object super; + const Process* process; + Panel* display; + FunctionBar* bar; + IncSet* inc; + Vector* lines; +} InfoScreen; typedef void(*InfoScreen_Scan)(InfoScreen*); typedef void(*InfoScreen_Draw)(InfoScreen*); @@ -27,15 +40,6 @@ typedef struct InfoScreenClass_ { #define InfoScreen_onErr(this_) As_InfoScreen(this_)->onErr((InfoScreen*)(this_)) #define InfoScreen_onKey(this_, ch_) As_InfoScreen(this_)->onKey((InfoScreen*)(this_), ch_) -struct InfoScreen_ { - Object super; - const Process* process; - Panel* display; - FunctionBar* bar; - IncSet* inc; - Vector* lines; -}; - InfoScreen* InfoScreen_init(InfoScreen* this, const Process* process, FunctionBar* bar, int height, const char* panelHeader); InfoScreen* InfoScreen_done(InfoScreen* this); diff --git a/ListItem.c b/ListItem.c index c4479d73..866f20ff 100644 --- a/ListItem.c +++ b/ListItem.c @@ -5,16 +5,18 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "ListItem.h" +#include +#include +#include + #include "CRT.h" #include "RichString.h" #include "XUtils.h" -#include -#include -#include - static void ListItem_delete(Object* cast) { ListItem* this = (ListItem*)cast; diff --git a/ListItem.h b/ListItem.h index 387e8e21..5bbcda14 100644 --- a/ListItem.h +++ b/ListItem.h @@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "Object.h" typedef struct ListItem_ { diff --git a/LoadAverageMeter.c b/LoadAverageMeter.c index c52bffc1..76b89ea1 100644 --- a/LoadAverageMeter.c +++ b/LoadAverageMeter.c @@ -8,7 +8,9 @@ in the source distribution for its full text. #include "LoadAverageMeter.h" #include "CRT.h" +#include "Object.h" #include "Platform.h" +#include "RichString.h" #include "XUtils.h" diff --git a/Macros.h b/Macros.h index 00413f4e..e42cbe53 100644 --- a/Macros.h +++ b/Macros.h @@ -1,6 +1,8 @@ #ifndef HEADER_Macros #define HEADER_Macros +#include // IWYU pragma: keep + #ifndef MINIMUM #define MINIMUM(a, b) ((a) < (b) ? (a) : (b)) #endif diff --git a/MainPanel.c b/MainPanel.c index 48d869ff..05a55e60 100644 --- a/MainPanel.c +++ b/MainPanel.c @@ -7,12 +7,20 @@ in the source distribution for its full text. */ #include "MainPanel.h" -#include "Process.h" -#include "Platform.h" -#include "CRT.h" +#include #include +#include "CRT.h" +#include "FunctionBar.h" +#include "Platform.h" +#include "Process.h" +#include "ProcessList.h" +#include "ProvideCurses.h" +#include "Settings.h" +#include "XUtils.h" + + static const char* const MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL}; void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) { diff --git a/MainPanel.h b/MainPanel.h index 9e2da305..7f7520d6 100644 --- a/MainPanel.h +++ b/MainPanel.h @@ -8,9 +8,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include +#include + #include "Action.h" #include "IncSet.h" +#include "Object.h" #include "Panel.h" +#include "Process.h" + typedef struct MainPanel_ { Panel super; diff --git a/Makefile.am b/Makefile.am index fd02bb3e..d5b05d06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -103,6 +103,7 @@ myhtopheaders = \ Panel.h \ Process.h \ ProcessList.h \ + ProvideCurses.h \ RichString.h \ ScreenManager.h \ Settings.h \ diff --git a/MemoryMeter.c b/MemoryMeter.c index 311f1791..3d29ddf4 100644 --- a/MemoryMeter.c +++ b/MemoryMeter.c @@ -8,13 +8,9 @@ in the source distribution for its full text. #include "MemoryMeter.h" #include "CRT.h" +#include "Object.h" #include "Platform.h" - -#include -#include -#include -#include -#include +#include "RichString.h" static const int MemoryMeter_attributes[] = { diff --git a/Meter.c b/Meter.c index 154a5a64..84370362 100644 --- a/Meter.c +++ b/Meter.c @@ -5,19 +5,23 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "Meter.h" -#include "RichString.h" -#include "Object.h" +#include +#include +#include +#include +#include + #include "CRT.h" -#include "Settings.h" +#include "Macros.h" +#include "Object.h" +#include "ProvideCurses.h" +#include "RichString.h" #include "XUtils.h" -#include -#include -#include -#include -#include #define GRAPH_HEIGHT 4 /* Unit: rows (lines) */ diff --git a/Meter.h b/Meter.h index 5432a768..84d157bb 100644 --- a/Meter.h +++ b/Meter.h @@ -7,12 +7,17 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include #include #include "ListItem.h" +#include "Object.h" +#include "ProcessList.h" + #define METER_BUFFER_LEN 256 +struct Meter_; typedef struct Meter_ Meter; typedef void(*Meter_Init)(Meter*); @@ -67,7 +72,7 @@ struct Meter_ { int param; GraphData* drawData; int h; - struct ProcessList_* pl; + ProcessList* pl; char curItems; double* values; double total; @@ -91,7 +96,7 @@ typedef enum { extern const MeterClass Meter_class; -Meter* Meter_new(struct ProcessList_* pl, int param, const MeterClass* type); +Meter* Meter_new(ProcessList* pl, int param, const MeterClass* type); int Meter_humanUnit(char* buffer, unsigned long int value, int size); diff --git a/MetersPanel.c b/MetersPanel.c index 89c54e0b..7e47ad8b 100644 --- a/MetersPanel.c +++ b/MetersPanel.c @@ -8,8 +8,14 @@ in the source distribution for its full text. #include "MetersPanel.h" #include -#include + #include "CRT.h" +#include "FunctionBar.h" +#include "Header.h" +#include "ListItem.h" +#include "Meter.h" +#include "Object.h" +#include "ProvideCurses.h" // Note: In code the meters are known to have bar/text/graph "Modes", but in UI diff --git a/MetersPanel.h b/MetersPanel.h index 760388d8..cf4de604 100644 --- a/MetersPanel.h +++ b/MetersPanel.h @@ -7,10 +7,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "Panel.h" #include "ScreenManager.h" #include "Settings.h" +#include "Vector.h" + +struct MetersPanel_; typedef struct MetersPanel_ MetersPanel; struct MetersPanel_ { diff --git a/NetworkIOMeter.c b/NetworkIOMeter.c index 07c7dc97..8c0cb45d 100644 --- a/NetworkIOMeter.c +++ b/NetworkIOMeter.c @@ -1,7 +1,14 @@ #include "NetworkIOMeter.h" +#include +#include + #include "CRT.h" +#include "Macros.h" +#include "Object.h" #include "Platform.h" +#include "RichString.h" +#include "XUtils.h" static const int NetworkIOMeter_attributes[] = { diff --git a/Object.c b/Object.c index 97e913e6..01b6c4ce 100644 --- a/Object.c +++ b/Object.c @@ -8,6 +8,9 @@ in the source distribution for its full text. #include "Object.h" +#include + + const ObjectClass Object_class = { .extends = NULL }; diff --git a/Object.h b/Object.h index 6c31fa34..2d3fd3c4 100644 --- a/Object.h +++ b/Object.h @@ -9,10 +9,10 @@ in the source distribution for its full text. */ #include "RichString.h" -#include "Macros.h" -#include "XUtils.h" +#include "XUtils.h" // IWYU pragma: keep +struct Object_; typedef struct Object_ Object; typedef void(*Object_Display)(const Object*, RichString*); @@ -29,7 +29,7 @@ typedef void(*Object_Delete)(Object*); #define Class(class_) ((const ObjectClass*)(&(class_ ## _class))) -#define AllocThis(class_) (class_*) xMalloc(sizeof(class_)); Object_setClass(this, Class(class_)); +#define AllocThis(class_) (class_*) xMalloc(sizeof(class_)); Object_setClass(this, Class(class_)); typedef struct ObjectClass_ { const void* const extends; diff --git a/OpenFilesScreen.c b/OpenFilesScreen.c index 8e099bbe..0de9ee03 100644 --- a/OpenFilesScreen.c +++ b/OpenFilesScreen.c @@ -5,24 +5,24 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "OpenFilesScreen.h" -#include "CRT.h" -#include "ProcessList.h" -#include "IncSet.h" -#include "FunctionBar.h" -#include "XUtils.h" - -#include -#include -#include -#include -#include -#include #include +#include +#include +#include +#include #include #include +#include "Macros.h" +#include "Panel.h" +#include "ProvideCurses.h" +#include "Vector.h" +#include "XUtils.h" + typedef struct OpenFiles_Data_ { char* data[7]; diff --git a/OpenFilesScreen.h b/OpenFilesScreen.h index 04a8e395..0fbafe0e 100644 --- a/OpenFilesScreen.h +++ b/OpenFilesScreen.h @@ -7,7 +7,11 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "InfoScreen.h" +#include "Object.h" +#include "Process.h" typedef struct OpenFilesScreen_ { InfoScreen super; diff --git a/Panel.c b/Panel.c index 76e45d6e..782cbdc1 100644 --- a/Panel.c +++ b/Panel.c @@ -7,17 +7,20 @@ in the source distribution for its full text. #include "Panel.h" -#include "CRT.h" -#include "RichString.h" -#include "ListItem.h" -#include "XUtils.h" - -#include +#include +#include #include #include -#include #include -#include +#include + +#include "CRT.h" +#include "ListItem.h" +#include "Macros.h" +#include "ProvideCurses.h" +#include "RichString.h" +#include "XUtils.h" + const PanelClass Panel_class = { .super = { diff --git a/Panel.h b/Panel.h index 4b28c42d..87846075 100644 --- a/Panel.h +++ b/Panel.h @@ -7,10 +7,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "FunctionBar.h" #include "Object.h" +#include "RichString.h" #include "Vector.h" + +struct Panel_; typedef struct Panel_ Panel; typedef enum HandlerResult_ { diff --git a/Process.c b/Process.c index 147caee6..6d9101a7 100644 --- a/Process.c +++ b/Process.c @@ -6,36 +6,35 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Process.h" -#include "Settings.h" +#include "config.h" // IWYU pragma: keep -#include "config.h" +#include "Process.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "CRT.h" -#include "RichString.h" #include "Platform.h" +#include "RichString.h" +#include "Settings.h" #include "XUtils.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef MAJOR_IN_MKDEV +#if defined(MAJOR_IN_MKDEV) #include #elif defined(MAJOR_IN_SYSMACROS) #include #endif + static int Process_getuid = -1; char Process_pidFormat[20] = "%7d "; diff --git a/Process.h b/Process.h index a4abf03e..190a98af 100644 --- a/Process.h +++ b/Process.h @@ -8,6 +8,14 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include +#include +#include + +#include "Object.h" +#include "RichString.h" + + #ifdef __ANDROID__ #define SYS_ioprio_get __NR_ioprio_get #define SYS_ioprio_set __NR_ioprio_set @@ -20,10 +28,6 @@ in the source distribution for its full text. #endif #define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K ) -#include - -#include "Object.h" - #define PROCESS_FLAG_IO 0x0001 typedef enum ProcessFields { diff --git a/ProcessList.c b/ProcessList.c index b7445431..b5a13f0a 100644 --- a/ProcessList.c +++ b/ProcessList.c @@ -7,13 +7,12 @@ in the source distribution for its full text. #include "ProcessList.h" -#include "CRT.h" -#include "Platform.h" -#include "XUtils.h" - -#include +#include #include +#include "CRT.h" +#include "XUtils.h" + ProcessList* ProcessList_init(ProcessList* this, const ObjectClass* klass, UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId) { this->processes = Vector_new(klass, true, DEFAULT_SIZE); diff --git a/ProcessList.h b/ProcessList.h index 164ff7b0..2dd2c8d2 100644 --- a/ProcessList.h +++ b/ProcessList.h @@ -7,9 +7,16 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + +#include +#include + #include "Hashtable.h" +#include "Object.h" #include "Panel.h" #include "Process.h" +#include "RichString.h" #include "Settings.h" #include "UsersTable.h" #include "Vector.h" @@ -18,6 +25,7 @@ in the source distribution for its full text. #include #endif + #ifndef MAX_NAME #define MAX_NAME 128 #endif diff --git a/ProvideCurses.h b/ProvideCurses.h new file mode 100644 index 00000000..c35d696d --- /dev/null +++ b/ProvideCurses.h @@ -0,0 +1,34 @@ +#ifndef HEADER_ProvideCurses +#define HEADER_ProvideCurses +/* +htop - RichString.h +(C) 2004,2011 Hisham H. Muhammad +Released under the GNU GPL, see the COPYING file +in the source distribution for its full text. +*/ + + +#include "config.h" + +// IWYU pragma: begin_exports + +#ifdef HAVE_NCURSESW_CURSES_H +#include +#elif defined(HAVE_NCURSES_NCURSES_H) +#include +#elif defined(HAVE_NCURSES_CURSES_H) +#include +#elif defined(HAVE_NCURSES_H) +#include +#elif defined(HAVE_CURSES_H) +#include +#endif + +#ifdef HAVE_LIBNCURSESW +#include +#include +#endif + +// IWYU pragma: end_exports + +#endif // HEADER_ProvideCurses diff --git a/RichString.c b/RichString.c index 3cb19ae4..60fe8d07 100644 --- a/RichString.c +++ b/RichString.c @@ -6,12 +6,14 @@ in the source distribution for its full text. */ #include "RichString.h" -#include "Macros.h" -#include "XUtils.h" +#include #include #include +#include "Macros.h" +#include "XUtils.h" + #define charBytes(n) (sizeof(CharType) * (n)) diff --git a/RichString.h b/RichString.h index 8ba0d6ed..2e35b827 100644 --- a/RichString.h +++ b/RichString.h @@ -7,26 +7,10 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ - #include "config.h" -#include -#include -#ifdef HAVE_NCURSESW_CURSES_H -#include -#elif defined(HAVE_NCURSES_NCURSES_H) -#include -#elif defined(HAVE_NCURSES_CURSES_H) -#include -#elif defined(HAVE_NCURSES_H) -#include -#elif defined(HAVE_CURSES_H) -#include -#endif +#include "ProvideCurses.h" -#ifdef HAVE_LIBNCURSESW -#include -#endif #define RichString_size(this) ((this)->chlen) #define RichString_sizeVal(this) ((this).chlen) diff --git a/ScreenManager.c b/ScreenManager.c index 4766e069..2fce07de 100644 --- a/ScreenManager.c +++ b/ScreenManager.c @@ -7,16 +7,17 @@ in the source distribution for its full text. #include "ScreenManager.h" +#include +#include +#include +#include + #include "CRT.h" -#include "MainPanel.h" +#include "FunctionBar.h" #include "Object.h" #include "ProcessList.h" - - -#include -#include -#include -#include +#include "ProvideCurses.h" +#include "XUtils.h" ScreenManager* ScreenManager_new(int x1, int y1, int x2, int y2, Orientation orientation, Header* header, const Settings* settings, const State* state, bool owner) { diff --git a/ScreenManager.h b/ScreenManager.h index ad312930..97e849f3 100644 --- a/ScreenManager.h +++ b/ScreenManager.h @@ -7,12 +7,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + #include "Action.h" #include "Header.h" #include "Panel.h" #include "Settings.h" #include "Vector.h" + typedef enum Orientation_ { VERTICAL, HORIZONTAL diff --git a/Settings.c b/Settings.c index fd623ad8..ac8321a0 100644 --- a/Settings.c +++ b/Settings.c @@ -7,15 +7,17 @@ in the source distribution for its full text. #include "Settings.h" +#include +#include +#include +#include + #include "CRT.h" +#include "Macros.h" +#include "Meter.h" #include "Platform.h" -#include "Vector.h" #include "XUtils.h" -#include -#include -#include -#include void Settings_delete(Settings* this) { free(this->filename); diff --git a/Settings.h b/Settings.h index 73da4f07..4eece3b0 100644 --- a/Settings.h +++ b/Settings.h @@ -7,12 +7,15 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#define DEFAULT_DELAY 15 +#include "config.h" // IWYU pragma: keep #include #include "Process.h" + +#define DEFAULT_DELAY 15 + typedef struct { int len; char** names; diff --git a/SignalsPanel.c b/SignalsPanel.c index 0ebe16d3..7937c5dc 100644 --- a/SignalsPanel.c +++ b/SignalsPanel.c @@ -5,17 +5,16 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Panel.h" #include "SignalsPanel.h" -#include -#include #include -#include +#include +#include "FunctionBar.h" #include "ListItem.h" +#include "Object.h" +#include "Panel.h" #include "Platform.h" -#include "RichString.h" #include "XUtils.h" diff --git a/SignalsPanel.h b/SignalsPanel.h index 9ded22f1..0a90b08e 100644 --- a/SignalsPanel.h +++ b/SignalsPanel.h @@ -7,6 +7,8 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "Panel.h" + typedef struct SignalItem_ { const char* name; int number; diff --git a/SwapMeter.c b/SwapMeter.c index fc4e6b28..9de7fa35 100644 --- a/SwapMeter.c +++ b/SwapMeter.c @@ -8,13 +8,9 @@ in the source distribution for its full text. #include "SwapMeter.h" #include "CRT.h" +#include "Object.h" #include "Platform.h" - -#include -#include -#include -#include -#include +#include "RichString.h" static const int SwapMeter_attributes[] = { diff --git a/TasksMeter.c b/TasksMeter.c index a13766ed..2116e322 100644 --- a/TasksMeter.c +++ b/TasksMeter.c @@ -8,7 +8,11 @@ in the source distribution for its full text. #include "TasksMeter.h" #include "CRT.h" -#include "Platform.h" +#include "Macros.h" +#include "Object.h" +#include "ProcessList.h" +#include "RichString.h" +#include "Settings.h" #include "XUtils.h" diff --git a/TraceScreen.c b/TraceScreen.c index a3c57870..e83e8a51 100644 --- a/TraceScreen.c +++ b/TraceScreen.c @@ -5,26 +5,28 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "TraceScreen.h" -#include "CRT.h" -#include "ProcessList.h" -#include "ListItem.h" -#include "IncSet.h" -#include "FunctionBar.h" -#include "XUtils.h" - -#include -#include -#include -#include -#include -#include +#include #include -#include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CRT.h" +#include "FunctionBar.h" +#include "IncSet.h" +#include "Panel.h" +#include "ProvideCurses.h" +#include "XUtils.h" static const char* const TraceScreenFunctions[] = {"Search ", "Filter ", "AutoScroll ", "Stop Tracing ", "Done ", NULL}; diff --git a/TraceScreen.h b/TraceScreen.h index 552d14fa..81920479 100644 --- a/TraceScreen.h +++ b/TraceScreen.h @@ -12,6 +12,8 @@ in the source distribution for its full text. #include #include "InfoScreen.h" +#include "Object.h" +#include "Process.h" typedef struct TraceScreen_ { diff --git a/UptimeMeter.c b/UptimeMeter.c index 1011aa10..89e34175 100644 --- a/UptimeMeter.c +++ b/UptimeMeter.c @@ -8,6 +8,7 @@ in the source distribution for its full text. #include "UptimeMeter.h" #include "CRT.h" +#include "Object.h" #include "Platform.h" #include "XUtils.h" diff --git a/UsersTable.c b/UsersTable.c index 41e52d3f..89fdfc4d 100644 --- a/UsersTable.c +++ b/UsersTable.c @@ -5,17 +5,12 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" - #include "UsersTable.h" -#include -#include -#include #include -#include +#include +#include #include -#include #include "XUtils.h" diff --git a/Vector.c b/Vector.c index 291ef48f..1dfccc44 100644 --- a/Vector.c +++ b/Vector.c @@ -10,7 +10,8 @@ in the source distribution for its full text. #include #include #include -#include + +#include "XUtils.h" Vector* Vector_new(const ObjectClass* type, bool owner, int size) { diff --git a/Vector.h b/Vector.h index 428b931d..3cff212c 100644 --- a/Vector.h +++ b/Vector.h @@ -9,6 +9,8 @@ in the source distribution for its full text. #include "Object.h" +#include + #ifndef DEFAULT_SIZE #define DEFAULT_SIZE (-1) diff --git a/XUtils.c b/XUtils.c index 4fccec3a..1e77cd3b 100644 --- a/XUtils.c +++ b/XUtils.c @@ -5,14 +5,13 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" +#include "config.h" // IWYU pragma: keep #include "XUtils.h" #include #include #include -#include #include #include "CRT.h" diff --git a/XUtils.h b/XUtils.h index 742b8e9e..f30af6f3 100644 --- a/XUtils.h +++ b/XUtils.h @@ -7,10 +7,11 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include -#include +#include "config.h" // IWYU pragma: keep + #include -#include +#include // IWYU pragma: keep +#include // IWYU pragma: keep #include "Macros.h" diff --git a/freebsd/FreeBSDProcess.h b/freebsd/FreeBSDProcess.h index 25094848..36657060 100644 --- a/freebsd/FreeBSDProcess.h +++ b/freebsd/FreeBSDProcess.h @@ -7,6 +7,14 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include + +#include "Object.h" +#include "Process.h" +#include "RichString.h" +#include "Settings.h" + + typedef enum FreeBSDProcessFields_ { // Add platform-specific fields here, with ids >= 100 JID = 100, diff --git a/freebsd/FreeBSDProcessList.c b/freebsd/FreeBSDProcessList.c index 92620c9b..62969876 100644 --- a/freebsd/FreeBSDProcessList.c +++ b/freebsd/FreeBSDProcessList.c @@ -5,24 +5,27 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Macros.h" -#include "ProcessList.h" #include "FreeBSDProcessList.h" -#include "FreeBSDProcess.h" -#include "zfs/ZfsArcStats.h" -#include "zfs/openzfs_sysctl.h" -#include "Macros.h" -#include -#include -#include -#include -#include +#include #include #include #include +#include #include #include +#include +#include +#include +#include + +#include "FreeBSDProcess.h" +#include "Macros.h" +#include "ProcessList.h" +#include "zfs/ZfsArcStats.h" +#include "zfs/openzfs_sysctl.h" +#include "XUtils.h" + char jail_errmsg[JAIL_ERRMSGLEN]; diff --git a/freebsd/FreeBSDProcessList.h b/freebsd/FreeBSDProcessList.h index 064433b3..75f71c12 100644 --- a/freebsd/FreeBSDProcessList.h +++ b/freebsd/FreeBSDProcessList.h @@ -7,14 +7,20 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "zfs/ZfsArcStats.h" - #include #include #include #include #include +#include "FreeBSDProcess.h" +#include "Hashtable.h" +#include "Process.h" +#include "ProcessList.h" +#include "UsersTable.h" +#include "zfs/ZfsArcStats.h" + + #define JAIL_ERRMSGLEN 1024 extern char jail_errmsg[JAIL_ERRMSGLEN]; diff --git a/htop.c b/htop.c index 39aeec1a..7d1c1b16 100644 --- a/htop.c +++ b/htop.c @@ -5,29 +5,37 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "config.h" - -#include "FunctionBar.h" -#include "Hashtable.h" -#include "ColumnsPanel.h" -#include "CRT.h" -#include "MainPanel.h" -#include "MetersPanel.h" -#include "ProcessList.h" -#include "ScreenManager.h" -#include "Settings.h" -#include "UsersTable.h" -#include "Platform.h" -#include "XUtils.h" +#include "config.h" // IWYU pragma: keep +#include #include #include +#include #include #include #include #include #include +#include "Action.h" +#include "ColumnsPanel.h" +#include "CRT.h" +#include "Hashtable.h" +#include "Header.h" +#include "IncSet.h" +#include "MainPanel.h" +#include "MetersPanel.h" +#include "Panel.h" +#include "Platform.h" +#include "Process.h" +#include "ProcessList.h" +#include "ProvideCurses.h" +#include "ScreenManager.h" +#include "Settings.h" +#include "UsersTable.h" +#include "XUtils.h" + + //#link m static void printVersionFlag(void) { diff --git a/linux/Battery.c b/linux/Battery.c index faf4064c..f3e2ff24 100644 --- a/linux/Battery.c +++ b/linux/Battery.c @@ -13,13 +13,17 @@ Linux battery readings written by Ian P. Hands (iphands@gmail.com, ihands@redhat #include #include -#include +#include +#include +#include +#include #include #include -#include #include -#include +#include +#include "BatteryMeter.h" +#include "Macros.h" #include "XUtils.h" diff --git a/linux/Battery.h b/linux/Battery.h index 496ce1a6..18b0dab6 100644 --- a/linux/Battery.h +++ b/linux/Battery.h @@ -11,6 +11,7 @@ Linux battery readings written by Ian P. Hands (iphands@gmail.com, ihands@redhat #include "BatteryMeter.h" + void Battery_getData(double* level, ACPresence* isOnAC); #endif diff --git a/linux/IOPriorityPanel.c b/linux/IOPriorityPanel.c index cc1b3916..50f57c10 100644 --- a/linux/IOPriorityPanel.c +++ b/linux/IOPriorityPanel.c @@ -7,6 +7,12 @@ in the source distribution for its full text. #include "IOPriorityPanel.h" +#include +#include + +#include "FunctionBar.h" +#include "ListItem.h" +#include "Object.h" #include "XUtils.h" diff --git a/linux/IOPriorityPanel.h b/linux/IOPriorityPanel.h index d7358226..2ac4b316 100644 --- a/linux/IOPriorityPanel.h +++ b/linux/IOPriorityPanel.h @@ -9,7 +9,6 @@ in the source distribution for its full text. #include "Panel.h" #include "IOPriority.h" -#include "ListItem.h" Panel* IOPriorityPanel_new(IOPriority currPrio); diff --git a/linux/LinuxProcess.c b/linux/LinuxProcess.c index 75900b5a..6d1e3ca6 100644 --- a/linux/LinuxProcess.c +++ b/linux/LinuxProcess.c @@ -6,19 +6,19 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ -#include "Process.h" -#include "ProcessList.h" #include "LinuxProcess.h" -#include "CRT.h" -#include "Platform.h" -#include "XUtils.h" -#include -#include -#include -#include -#include #include +#include +#include +#include +#include +#include + +#include "CRT.h" +#include "Process.h" +#include "ProvideCurses.h" +#include "XUtils.h" /* semi-global */ diff --git a/linux/LinuxProcess.h b/linux/LinuxProcess.h index ac80317d..8e7c36dc 100644 --- a/linux/LinuxProcess.h +++ b/linux/LinuxProcess.h @@ -8,6 +8,17 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" + +#include +#include + +#include "IOPriority.h" +#include "Object.h" +#include "Process.h" +#include "RichString.h" +#include "Settings.h" + #define PROCESS_FLAG_LINUX_IOPRIO 0x0100 #define PROCESS_FLAG_LINUX_OPENVZ 0x0200 #define PROCESS_FLAG_LINUX_VSERVER 0x0400 @@ -87,8 +98,6 @@ typedef enum LinuxProcessFields { LAST_PROCESSFIELD = 124, } LinuxProcessField; -#include "IOPriority.h" - typedef struct LinuxProcess_ { Process super; bool isKernelThread; diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index bbb064d1..1ed13826 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -5,43 +5,51 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" // IWYU pragma: keep + #include "LinuxProcessList.h" -#include "LinuxProcess.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_DELAYACCT +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + #include "CRT.h" +#include "LinuxProcess.h" +#include "Macros.h" +#include "Object.h" +#include "Process.h" +#include "Settings.h" #include "XUtils.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #ifdef MAJOR_IN_MKDEV #include #elif defined(MAJOR_IN_SYSMACROS) #include #endif -#ifdef HAVE_DELAYACCT -#include -#include -#include -#include -#include -#include -#include -#endif static ssize_t xread(int fd, void *buf, size_t count) { // Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested. diff --git a/linux/LinuxProcessList.h b/linux/LinuxProcessList.h index 913f3cb4..57bc9dc0 100644 --- a/linux/LinuxProcessList.h +++ b/linux/LinuxProcessList.h @@ -7,7 +7,14 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" + +#include +#include + +#include "Hashtable.h" #include "ProcessList.h" +#include "UsersTable.h" #include "zfs/ZfsArcStats.h" typedef struct CPUData_ { diff --git a/linux/Platform.c b/linux/Platform.c index feb6b6cf..1bb476ab 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -5,39 +5,48 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include "config.h" + #include "Platform.h" + +#include +#include +#include +#include +#include + +#include "BatteryMeter.h" +#include "ClockMeter.h" +#include "CPUMeter.h" +#include "DateMeter.h" +#include "DateTimeMeter.h" +#include "DiskIOMeter.h" +#include "HostnameMeter.h" #include "IOPriority.h" #include "IOPriorityPanel.h" #include "LinuxProcess.h" #include "LinuxProcessList.h" -#include "Battery.h" - +#include "LoadAverageMeter.h" +#include "Macros.h" +#include "MainPanel.h" #include "Meter.h" -#include "CPUMeter.h" -#include "DiskIOMeter.h" #include "MemoryMeter.h" +#include "NetworkIOMeter.h" +#include "Object.h" +#include "Panel.h" +#include "PressureStallMeter.h" +#include "ProcessList.h" +#include "ProvideCurses.h" +#include "SELinuxMeter.h" +#include "Settings.h" #include "SwapMeter.h" #include "TasksMeter.h" -#include "LoadAverageMeter.h" #include "UptimeMeter.h" -#include "PressureStallMeter.h" -#include "ClockMeter.h" -#include "DateMeter.h" -#include "DateTimeMeter.h" -#include "HostnameMeter.h" -#include "NetworkIOMeter.h" -#include "zfs/ZfsArcMeter.h" -#include "zfs/ZfsCompressedArcMeter.h" -#include "LinuxProcess.h" -#include "SELinuxMeter.h" #include "XUtils.h" -#include -#include -#include -#include -#include -#include +#include "zfs/ZfsArcMeter.h" +#include "zfs/ZfsArcStats.h" +#include "zfs/ZfsCompressedArcMeter.h" ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_RESIDENT, (int)M_SHARE, STATE, PERCENT_CPU, PERCENT_MEM, TIME, COMM, 0 }; diff --git a/linux/Platform.h b/linux/Platform.h index 007cd32b..3d4cabac 100644 --- a/linux/Platform.h +++ b/linux/Platform.h @@ -7,10 +7,12 @@ Released under the GNU GPLv2, see the COPYING file in the source distribution for its full text. */ +#include +#include + #include "Action.h" -#include "MainPanel.h" -#include "BatteryMeter.h" -#include "LinuxProcess.h" +#include "Meter.h" +#include "Process.h" #include "SignalsPanel.h" extern ProcessField Platform_defaultFields[]; diff --git a/linux/PressureStallMeter.c b/linux/PressureStallMeter.c index 4733415f..9ac0ced2 100644 --- a/linux/PressureStallMeter.c +++ b/linux/PressureStallMeter.c @@ -8,10 +8,14 @@ in the source distribution for its full text. #include "PressureStallMeter.h" +#include #include #include "CRT.h" +#include "Meter.h" +#include "Object.h" #include "Platform.h" +#include "RichString.h" #include "XUtils.h" diff --git a/linux/SELinuxMeter.c b/linux/SELinuxMeter.c index 8562215b..275eefef 100644 --- a/linux/SELinuxMeter.c +++ b/linux/SELinuxMeter.c @@ -10,12 +10,16 @@ in the source distribution for its full text. #include "CRT.h" #include -#include -#include -#include -#include -#include +#include +#include #include +#include +#include +#include + +#include "Macros.h" +#include "Object.h" +#include "XUtils.h" static const int SELinuxMeter_attributes[] = { diff --git a/zfs/ZfsArcMeter.c b/zfs/ZfsArcMeter.c index acfe13f2..55ef2c56 100644 --- a/zfs/ZfsArcMeter.c +++ b/zfs/ZfsArcMeter.c @@ -9,19 +9,10 @@ in the source distribution for its full text. #include "ZfsArcStats.h" #include "CRT.h" +#include "Object.h" #include "Platform.h" +#include "RichString.h" -#include -#include -#include -#include -#include - -/*{ -#include "ZfsArcStats.h" - -#include "Meter.h" -}*/ static const int ZfsArcMeter_attributes[] = { ZFS_MFU, ZFS_MRU, ZFS_ANON, ZFS_HEADER, ZFS_OTHER diff --git a/zfs/ZfsCompressedArcMeter.c b/zfs/ZfsCompressedArcMeter.c index 0153fccb..0a67c7ed 100644 --- a/zfs/ZfsCompressedArcMeter.c +++ b/zfs/ZfsCompressedArcMeter.c @@ -6,23 +6,16 @@ in the source distribution for its full text. */ #include "ZfsCompressedArcMeter.h" -#include "ZfsArcStats.h" #include "CRT.h" +#include "Meter.h" +#include "Object.h" #include "Platform.h" +#include "RichString.h" #include "XUtils.h" -#include -#include -#include -#include -#include +#include "zfs/ZfsArcStats.h" -/*{ -#include "ZfsArcStats.h" - -#include "Meter.h" -}*/ static const int ZfsCompressedArcMeter_attributes[] = { ZFS_COMPRESSED