Skip to content

Commit 23cc042

Browse files
authored
Merge branch 'htop-dev:main' into main
2 parents c2bb19e + e136be5 commit 23cc042

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

CRT.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ in the source distribution for its full text.
1212
#include <errno.h>
1313
#include <fcntl.h>
1414
#include <langinfo.h>
15+
#include <limits.h>
1516
#include <signal.h>
1617
#include <stdarg.h>
1718
#include <stdio.h>
@@ -94,21 +95,31 @@ const char* const* CRT_treeStr = CRT_treeStrAscii;
9495

9596
static const Settings* CRT_settings;
9697

97-
const char* CRT_degreeSign;
98+
#ifdef HAVE_LIBNCURSESW
99+
# if MB_LEN_MAX >= 3 // Minimum required to support UTF-8 BMP subset
100+
char CRT_degreeSign[MB_LEN_MAX * 2] = "\xc2\xb0";
101+
# else
102+
char CRT_degreeSign[MB_LEN_MAX * 2] = "";
103+
# endif
104+
#else
105+
char CRT_degreeSign[] = "";
106+
#endif
98107

99-
static const char* initDegreeSign(void) {
108+
static void initDegreeSign(void) {
100109
#ifdef HAVE_LIBNCURSESW
110+
# if MB_LEN_MAX >= 3
101111
if (CRT_utf8)
102-
return "\xc2\xb0";
112+
return;
113+
# endif
103114

104-
static char buffer[4];
105115
// this might fail if the current locale does not support wide characters
106-
int r = snprintf(buffer, sizeof(buffer), "%lc", 176);
107-
if (r > 0)
108-
return buffer;
116+
int r = snprintf(CRT_degreeSign, sizeof(CRT_degreeSign), "%lc", 176);
117+
if (r <= 0 || (size_t)r >= sizeof(CRT_degreeSign))
118+
CRT_degreeSign[0] = '\0';
109119
#endif
110120

111-
return "";
121+
// No-op
122+
return;
112123
}
113124

114125
const int* CRT_colors;
@@ -1265,7 +1276,7 @@ IGNORE_WCASTQUAL_END
12651276

12661277
CRT_setMouse(settings->enableMouse);
12671278

1268-
CRT_degreeSign = initDegreeSign();
1279+
initDegreeSign();
12691280
}
12701281

12711282
void CRT_done(void) {

CRT.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void CRT_handleSIGSEGV(int signal) ATTR_NORETURN;
182182
#define KEY_FOCUS_OUT (KEY_MAX + 'O')
183183
#define KEY_DEL_MAC 127
184184

185-
extern const char* CRT_degreeSign;
185+
extern char CRT_degreeSign[];
186186

187187
#ifdef HAVE_LIBNCURSESW
188188

Process.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,12 @@ void Process_makeCommandStr(Process* this, const Settings* settings) {
295295
} \
296296
} \
297297
break; \
298+
case 'n': \
299+
CHECK_AND_MARK(str_, "/nix/store/"); \
300+
break; \
301+
case 'r': \
302+
CHECK_AND_MARK(str_, "/run/current-system/"); \
303+
break; \
298304
} \
299305
} while (0)
300306

configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,11 @@ AS_VAR_IF(CACHEVAR,yes,
12171217
AS_VAR_POPDEF([CACHEVAR])dnl
12181218
])dnl AX_CHECK_COMPILE_FLAGS
12191219

1220-
AX_CHECK_COMPILE_FLAG([-Wextra-semi-stmt], [AM_CFLAGS="$AM_CFLAGS -Wextra-semi-stmt"], , [-Werror=unknown-warning-option]) dnl the autoconf check itself generates -Wextra-semi-stmt
1220+
dnl During the check of '-Wextra-semi-stmt' we must treat
1221+
dnl 'extra-semi-stmt' as a non-error because the AC_LANG_PROGRAM
1222+
dnl template will generate a warning of this (by design).
1223+
AX_CHECK_COMPILE_FLAG([-Wextra-semi-stmt], [AM_CFLAGS="$AM_CFLAGS -Wextra-semi-stmt"], , [-Werror -Wno-error=extra-semi-stmt])
1224+
12211225
AX_CHECK_COMPILE_FLAG([-Wimplicit-int-conversion], [AM_CFLAGS="$AM_CFLAGS -Wimplicit-int-conversion"], , [-Werror])
12221226
AX_CHECK_COMPILE_FLAG([-Wnull-dereference], [AM_CFLAGS="$AM_CFLAGS -Wnull-dereference"], , [-Werror])
12231227

0 commit comments

Comments
 (0)