From e70325e83d97d6cef9bd38f6c5e4e0a7af5dd6fc Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 14 Jan 2020 10:08:19 +0000 Subject: user/*: Modernise / fix syntax / deps / code / tests --- user/htop/correctness.patch | 78 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 user/htop/correctness.patch (limited to 'user/htop/correctness.patch') diff --git a/user/htop/correctness.patch b/user/htop/correctness.patch new file mode 100644 index 000000000..51a9848d2 --- /dev/null +++ b/user/htop/correctness.patch @@ -0,0 +1,78 @@ +From: Jonathan Currier + +diff --git a/MainPanel.h b/MainPanel.h +index 8849659..471870b 100644 +--- a/MainPanel.h ++++ b/MainPanel.h +@@ -12,6 +12,7 @@ in the source distribution for its full text. + #include "Panel.h" + #include "Action.h" + #include "Settings.h" ++#include "union-arg.h" + + typedef struct MainPanel_ { + Panel super; +@@ -21,11 +22,6 @@ typedef struct MainPanel_ { + pid_t pidSearch; + } MainPanel; + +-typedef union { +- int i; +- void* v; +-} Arg; +- + typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg); + + #define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar) +diff --git a/Process.c b/Process.c +index 471f529..ae617a6 100644 +--- a/Process.c ++++ b/Process.c +@@ -548,7 +548,9 @@ bool Process_changePriorityBy(Process* this, int delta) { + return Process_setPriority(this, this->nice + delta); + } + +-void Process_sendSignal(Process* this, int sgn) { ++ ++void Process_sendSignal(Process* this, Arg arg) { ++ int sgn = arg.i; + CRT_dropPrivileges(); + kill(this->pid, (int) sgn); + CRT_restorePrivileges(); +diff --git a/Process.h b/Process.h +index f702ca0..3011845 100644 +--- a/Process.h ++++ b/Process.h +@@ -29,6 +29,7 @@ in the source distribution for its full text. + #include "Object.h" + + #include ++#include "union-arg.h" + + #define PROCESS_FLAG_IO 0x0001 + +@@ -199,7 +200,7 @@ bool Process_setPriority(Process* this, int priority); + + bool Process_changePriorityBy(Process* this, int delta); + +-void Process_sendSignal(Process* this, int sgn); ++void Process_sendSignal(Process* this, Arg arg); + + long Process_pidCompare(const void* v1, const void* v2); + +diff --git a/union-arg.h b/union-arg.h +new file mode 100644 +index 0000000..5c8a094 +--- /dev/null ++++ b/union-arg.h +@@ -0,0 +1,9 @@ ++#ifndef UNION_ARG_HEADER ++#define UNION_ARG_HEADER ++ ++typedef union { ++ int i; ++ void* v; ++} Arg; ++ ++#endif + -- cgit v1.2.3-70-g09d2