mirror of
https://github.com/xzeldon/htop.git
synced 2024-12-23 22:55:46 +00:00
Avoid checking of undefined macros
These feature macros are either define or not defined at all at the configure step.
This commit is contained in:
parent
c3952e7c20
commit
b85a31415e
4
Action.c
4
Action.c
@ -279,7 +279,7 @@ static Htop_Reaction actionQuit(ATTR_UNUSED State* st) {
|
||||
static Htop_Reaction actionSetAffinity(State* st) {
|
||||
if (st->pl->cpuCount == 1)
|
||||
return HTOP_OK;
|
||||
#if (HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY)
|
||||
#if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
|
||||
Panel* panel = st->panel;
|
||||
|
||||
Process* p = (Process*) Panel_getSelected(panel);
|
||||
@ -416,7 +416,7 @@ static const struct { const char* key; const char* info; } helpRight[] = {
|
||||
{ .key = " F9 k: ", .info = "kill process/tagged processes" },
|
||||
{ .key = " F7 ]: ", .info = "higher priority (root only)" },
|
||||
{ .key = " F8 [: ", .info = "lower priority (+ nice)" },
|
||||
#if (HAVE_LIBHWLOC || HAVE_LINUX_AFFINITY)
|
||||
#if (defined(HAVE_LIBHWLOC) || defined(HAVE_LINUX_AFFINITY))
|
||||
{ .key = " a: ", .info = "set CPU affinity" },
|
||||
#endif
|
||||
{ .key = " e: ", .info = "show process environment" },
|
||||
|
@ -12,12 +12,12 @@ in the source distribution for its full text.
|
||||
|
||||
#ifdef HAVE_LIBHWLOC
|
||||
#include <hwloc.h>
|
||||
#if __linux__
|
||||
#ifdef __linux__
|
||||
#define HTOP_HWLOC_CPUBIND_FLAG HWLOC_CPUBIND_THREAD
|
||||
#else
|
||||
#define HTOP_HWLOC_CPUBIND_FLAG HWLOC_CPUBIND_PROCESS
|
||||
#endif
|
||||
#elif HAVE_LINUX_AFFINITY
|
||||
#elif defined(HAVE_LINUX_AFFINITY)
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
||||
@ -79,7 +79,7 @@ bool Affinity_set(Process* proc, Arg arg) {
|
||||
return ok;
|
||||
}
|
||||
|
||||
#elif HAVE_LINUX_AFFINITY
|
||||
#elif defined(HAVE_LINUX_AFFINITY)
|
||||
|
||||
Affinity* Affinity_get(Process* proc, ProcessList* pl) {
|
||||
cpu_set_t cpuset;
|
||||
|
8
CRT.c
8
CRT.c
@ -18,7 +18,7 @@ in the source distribution for its full text.
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#if HAVE_SETUID_ENABLED
|
||||
#ifdef HAVE_SETUID_ENABLED
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@ -519,7 +519,7 @@ static void CRT_handleSIGTERM(int sgn) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#if HAVE_SETUID_ENABLED
|
||||
#ifdef HAVE_SETUID_ENABLED
|
||||
|
||||
static int CRT_euid = -1;
|
||||
|
||||
@ -550,11 +550,11 @@ void CRT_restorePrivileges() {
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* HAVE_SETUID_ENABLED */
|
||||
|
||||
// In this case, the setuid operations are defined as macros in CRT.h
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_SETUID_ENABLED */
|
||||
|
||||
// TODO: pass an instance of Settings instead.
|
||||
|
||||
|
6
CRT.h
6
CRT.h
@ -147,13 +147,13 @@ extern int CRT_colorScheme;
|
||||
|
||||
extern void *backtraceArray[128];
|
||||
|
||||
#if HAVE_SETUID_ENABLED
|
||||
#ifdef HAVE_SETUID_ENABLED
|
||||
|
||||
void CRT_dropPrivileges(void);
|
||||
|
||||
void CRT_restorePrivileges(void);
|
||||
|
||||
#else
|
||||
#else /* HAVE_SETUID_ENABLED */
|
||||
|
||||
/* Turn setuid operations into NOPs */
|
||||
|
||||
@ -162,7 +162,7 @@ void CRT_restorePrivileges(void);
|
||||
#define CRT_restorePrivileges()
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_SETUID_ENABLED */
|
||||
|
||||
void CRT_init(int delay, int colorScheme, bool allowUnicode);
|
||||
|
||||
|
@ -70,7 +70,7 @@ int RichString_findChar(RichString* this, char c, int start) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* HAVE_LIBNCURSESW */
|
||||
|
||||
static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
|
||||
int newLen = from + len;
|
||||
@ -99,7 +99,7 @@ int RichString_findChar(RichString* this, char c, int start) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_LIBNCURSESW */
|
||||
|
||||
void RichString_prune(RichString* this) {
|
||||
if (this->chlen > RICHSTRING_MAXLEN)
|
||||
|
12
RichString.h
12
RichString.h
@ -14,13 +14,13 @@ in the source distribution for its full text.
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_NCURSESW_CURSES_H
|
||||
#include <ncursesw/curses.h>
|
||||
#elif HAVE_NCURSES_NCURSES_H
|
||||
#elif defined(HAVE_NCURSES_NCURSES_H)
|
||||
#include <ncurses/ncurses.h>
|
||||
#elif HAVE_NCURSES_CURSES_H
|
||||
#elif defined(HAVE_NCURSES_CURSES_H)
|
||||
#include <ncurses/curses.h>
|
||||
#elif HAVE_NCURSES_H
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#elif HAVE_CURSES_H
|
||||
#elif defined(HAVE_CURSES_H)
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
@ -63,13 +63,13 @@ void RichString_setAttrn(RichString* this, int attrs, int start, int finish);
|
||||
|
||||
int RichString_findChar(RichString* this, char c, int start);
|
||||
|
||||
#else
|
||||
#else /* HAVE_LIBNCURSESW */
|
||||
|
||||
void RichString_setAttrn(RichString* this, int attrs, int start, int finish);
|
||||
|
||||
int RichString_findChar(RichString* this, char c, int start);
|
||||
|
||||
#endif
|
||||
#endif /* HAVE_LIBNCURSESW */
|
||||
|
||||
void RichString_prune(RichString* this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user