Skip to content

Commit 7d82839

Browse files
authored
Merge branch 'htop-dev:main' into main
2 parents 3190e15 + 70f873e commit 7d82839

File tree

8 files changed

+38
-42
lines changed

8 files changed

+38
-42
lines changed

DisplayOptionsPanel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static HandlerResult DisplayOptionsPanel_eventHandler(Panel* super, int ch) {
107107
}
108108
/* fallthrough */
109109
case EVENT_SET_SELECTED:
110-
if (OptionItem_kind(selected) == OPTION_ITEM_NUMBER) {
110+
if (selected && OptionItem_kind(selected) == OPTION_ITEM_NUMBER) {
111111
super->currentBar = this->decIncBar;
112112
} else {
113113
Panel_setDefaultBar(super);

Settings.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ int Settings_write(const Settings* this, bool onCrash) {
660660
}
661661
fp = fdopen(fdtmp, "w");
662662
if (!fp) {
663+
close(fdtmp);
663664
free(tmpFilename);
664665
return -errno;
665666
}

Table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void Table_buildTreeBranch(Table* this, int rowid, unsigned int level, in
9898
int l = 0;
9999
int r = vsize;
100100
while (l < r) {
101-
int c = (l + r) / 2;
101+
int c = l + (r - l) / 2;
102102
Row* row = (Row*)Vector_get(this->rows, c);
103103
int parent = row->isRoot ? 0 : Row_getGroupOrParent(row);
104104
if (parent < rowid) {

configure.ac

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ case "$enable_pcp" in
152152
AC_CHECK_HEADERS(
153153
[pcp/pmapi.h],
154154
[my_htop_platform=pcp],
155-
[AC_MSG_ERROR([can not find PCP header file])]
155+
[AC_MSG_ERROR([cannot find PCP header file])]
156156
)
157157
AC_SEARCH_LIBS(
158158
[pmNewContext],
159159
[pcp],
160160
[],
161-
[AC_MSG_ERROR([can not find PCP library])]
161+
[AC_MSG_ERROR([cannot find PCP library])]
162162
)
163163
AC_DEFINE([HTOP_PCP], [1], [Define if building pcp-htop binary.])
164164
AC_CONFIG_FILES([pcp-htop.5])
@@ -192,7 +192,7 @@ AC_CHECK_HEADERS(
192192
unistd.h \
193193
],
194194
[],
195-
[AC_MSG_ERROR([can not find required generic header files])]
195+
[AC_MSG_ERROR([cannot find required generic header files])]
196196
)
197197

198198
AC_HEADER_MAJOR
@@ -340,7 +340,7 @@ AC_LINK_IFELSE(
340340
],
341341
[
342342
AC_MSG_RESULT(no)
343-
AC_MSG_ERROR([can not find required macros: NAN, isgreater() and isgreaterequal()])
343+
AC_MSG_ERROR([cannot find required macros: NAN, isgreater() and isgreaterequal()])
344344
]
345345
)
346346

@@ -362,40 +362,40 @@ AC_COMPILE_IFELSE(
362362
# Checks for generic library functions.
363363
# ----------------------------------------------------------------------
364364

365-
AC_SEARCH_LIBS([ceil], [m], [], [AC_MSG_ERROR([can not find required function ceil()])])
365+
AC_SEARCH_LIBS([ceil], [m], [], [AC_MSG_ERROR([cannot find required function ceil()])])
366366

367367
if test "$my_htop_platform" = dragonflybsd; then
368-
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
369-
AC_SEARCH_LIBS([getdevs], [devstat], [], [AC_MSG_ERROR([can not find required function getdevs()])])
368+
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([cannot find required function kvm_open()])])
369+
AC_SEARCH_LIBS([getdevs], [devstat], [], [AC_MSG_ERROR([cannot find required function getdevs()])])
370370
fi
371371

372372
if test "$my_htop_platform" = freebsd; then
373373
if test "$enable_static" = yes; then
374-
AC_SEARCH_LIBS([elf_version], [elf], [], [AC_MSG_ERROR([can not find required function elf_version()])])
374+
AC_SEARCH_LIBS([elf_version], [elf], [], [AC_MSG_ERROR([cannot find required function elf_version()])])
375375
fi
376-
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
377-
AC_SEARCH_LIBS([devstat_checkversion], [devstat], [], [AC_MSG_ERROR([can not find required function devstat_checkversion()])])
376+
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([cannot find required function kvm_open()])])
377+
AC_SEARCH_LIBS([devstat_checkversion], [devstat], [], [AC_MSG_ERROR([cannot find required function devstat_checkversion()])])
378378
fi
379379

380380
if test "$my_htop_platform" = linux; then
381381
if test "$enable_static" != yes; then
382-
AC_SEARCH_LIBS([dlopen], [dl dld], [], [AC_MSG_ERROR([can not find required function dlopen()])])
382+
AC_SEARCH_LIBS([dlopen], [dl dld], [], [AC_MSG_ERROR([cannot find required function dlopen()])])
383383
fi
384384
fi
385385

386386
if test "$my_htop_platform" = netbsd; then
387-
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
388-
AC_SEARCH_LIBS([prop_dictionary_get], [prop], [], [AC_MSG_ERROR([can not find required function prop_dictionary_get()])])
387+
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([cannot find required function kvm_open()])])
388+
AC_SEARCH_LIBS([prop_dictionary_get], [prop], [], [AC_MSG_ERROR([cannot find required function prop_dictionary_get()])])
389389
fi
390390

391391
if test "$my_htop_platform" = openbsd; then
392-
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([can not find required function kvm_open()])])
392+
AC_SEARCH_LIBS([kvm_open], [kvm], [], [AC_MSG_ERROR([cannot find required function kvm_open()])])
393393
fi
394394

395395
if test "$my_htop_platform" = solaris; then
396-
AC_SEARCH_LIBS([kstat_open], [kstat], [], [AC_MSG_ERROR([can not find required function kstat_open()])])
397-
AC_SEARCH_LIBS([Pgrab_error], [proc], [], [AC_MSG_ERROR([can not find required function Pgrab_error()])])
398-
AC_SEARCH_LIBS([free], [malloc], [], [AC_MSG_ERROR([can not find required function free()])])
396+
AC_SEARCH_LIBS([kstat_open], [kstat], [], [AC_MSG_ERROR([cannot find required function kstat_open()])])
397+
AC_SEARCH_LIBS([Pgrab_error], [proc], [], [AC_MSG_ERROR([cannot find required function Pgrab_error()])])
398+
AC_SEARCH_LIBS([free], [malloc], [], [AC_MSG_ERROR([cannot find required function free()])])
399399
fi
400400

401401
# Optional Section
@@ -828,9 +828,9 @@ else
828828
fi
829829

830830
if test "$have_curses_header" = no; then
831-
AC_MSG_ERROR([can not find required curses header file])
831+
AC_MSG_ERROR([cannot find required curses header file])
832832
elif test "$have_term_header" = no; then
833-
AC_MSG_ERROR([can not find required term header file])
833+
AC_MSG_ERROR([cannot find required term header file])
834834
fi
835835

836836
CFLAGS="-I$srcdir $CFLAGS"
@@ -872,7 +872,7 @@ if test "$enable_static" = yes; then
872872
fi
873873
if test "$my_htop_platform" = "solaris"; then
874874
# On OmniOS /usr/include/sys/regset.h redefines ERR to 13 - \r, breaking the Enter key.
875-
# Since ncurses macros use the ERR macro, we can not use another name.
875+
# Since ncurses macros use the ERR macro, we cannot use another name.
876876
AC_DEFINE([ERR], [(-1)], [Predefine ncurses macro.])
877877
fi
878878
AC_CHECK_FUNCS([set_escdelay])
@@ -1009,7 +1009,7 @@ case "$enable_unwind" in
10091009
if htop_search_header_dir libunwind.h "/usr/include/libunwind"; then
10101010
AC_DEFINE([HAVE_LIBUNWIND_H], 1, [Define to 1 if you have the <libunwind.h> header file.])
10111011
elif test "$enable_unwind" = yes; then
1012-
AC_MSG_ERROR([can not find required header file libunwind.h])
1012+
AC_MSG_ERROR([cannot find required header file libunwind.h])
10131013
else
10141014
enable_unwind=no
10151015
fi
@@ -1082,7 +1082,7 @@ if test "$enable_unwind" != no; then
10821082
[
10831083
AC_MSG_RESULT([no])
10841084
if test "$enable_unwind" = yes; then
1085-
AC_MSG_FAILURE([can not link with libunwind])
1085+
AC_MSG_FAILURE([cannot link with libunwind])
10861086
else
10871087
LIBS=$htop_save_LIBS
10881088
enable_unwind=no
@@ -1184,8 +1184,8 @@ case "$enable_hwloc" in
11841184
LIBS="$LIBS $HWLOC_LIBS"
11851185
AC_DEFINE([HAVE_LIBHWLOC], [1], [Define to 1 if you have the 'hwloc' library (-lhwloc).])
11861186
], [
1187-
AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([can not find required library libhwloc])])
1188-
AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([can not find require header file hwloc.h])])
1187+
AC_CHECK_LIB([hwloc], [hwloc_get_proc_cpubind], [], [AC_MSG_ERROR([cannot find required library libhwloc])])
1188+
AC_CHECK_HEADERS([hwloc.h], [], [AC_MSG_ERROR([cannot find require header file hwloc.h])])
11891189
]
11901190
)
11911191
;;
@@ -1298,8 +1298,8 @@ case "$enable_capabilities" in
12981298
AC_CHECK_HEADERS([sys/capability.h], [], [enable_capabilities=no])
12991299
;;
13001300
yes)
1301-
AC_CHECK_LIB([cap], [cap_init], [], [AC_MSG_ERROR([can not find required library libcap])])
1302-
AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([can not find required header file sys/capability.h])])
1301+
AC_CHECK_LIB([cap], [cap_init], [], [AC_MSG_ERROR([cannot find required library libcap])])
1302+
AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([cannot find required header file sys/capability.h])])
13031303
;;
13041304
*)
13051305
AC_MSG_ERROR([bad value '$enable_capabilities' for --enable-capabilities])
@@ -1372,7 +1372,7 @@ case "$enable_delayacct" in
13721372
[],
13731373
[
13741374
if test "$enable_delayacct" = yes; then
1375-
AC_MSG_ERROR([can not find required header files netlink/attr.h, netlink/handlers.h, netlink/msg.h])
1375+
AC_MSG_ERROR([cannot find required header files netlink/attr.h, netlink/handlers.h, netlink/msg.h])
13761376
fi
13771377
enable_delayacct=no
13781378
]
@@ -1435,9 +1435,9 @@ case "$enable_sensors" in
14351435
;;
14361436
yes)
14371437
if test "$enable_static" = yes; then
1438-
AC_CHECK_LIB([sensors], [sensors_init], [], [AC_MSG_ERROR([can not find required library libsensors])])
1438+
AC_CHECK_LIB([sensors], [sensors_init], [], [AC_MSG_ERROR([cannot find required library libsensors])])
14391439
fi
1440-
AC_CHECK_HEADERS([sensors/sensors.h], [], [AC_MSG_ERROR([can not find required header file sensors/sensors.h])])
1440+
AC_CHECK_HEADERS([sensors/sensors.h], [], [AC_MSG_ERROR([cannot find required header file sensors/sensors.h])])
14411441
;;
14421442
*)
14431443
AC_MSG_ERROR([bad value '$enable_sensors' for --enable-sensors])

darwin/Platform.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,9 @@ void Platform_setGPUValues(Meter* mtr, double* totalUsage, unsigned long long* t
365365
return;
366366
}
367367

368-
CFMutableDictionaryRef properties = NULL;
369-
kern_return_t ret = IORegistryEntryCreateCFProperties(dhost->GPUService, &properties, kCFAllocatorDefault, kNilOptions);
370-
if (ret != KERN_SUCCESS || !properties)
371-
return;
372-
373-
CFDictionaryRef perfStats = CFDictionaryGetValue(properties, CFSTR("PerformanceStatistics"));
368+
CFDictionaryRef perfStats = IORegistryEntryCreateCFProperty(dhost->GPUService, CFSTR("PerformanceStatistics"), kCFAllocatorDefault, kNilOptions);
374369
if (!perfStats)
375-
goto cleanup;
370+
return;
376371

377372
assert(CFGetTypeID(perfStats) == CFDictionaryGetTypeID());
378373

@@ -387,7 +382,7 @@ void Platform_setGPUValues(Meter* mtr, double* totalUsage, unsigned long long* t
387382
prevMonotonicMs = host->monotonicMs;
388383

389384
cleanup:
390-
CFRelease(properties);
385+
CFRelease(perfStats);
391386

392387
mtr->values[0] = *totalUsage;
393388
}

linux/LinuxProcess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void Process_delete(Object* cast) {
139139
an io priority formally uses "none" as scheduling class, but the
140140
io scheduler will treat such processes as if it were in the best
141141
effort class. The priority within the best effort class will be
142-
dynamically derived from the cpu nice level of the process:
142+
dynamically derived from the cpu nice level of the process:
143143
io_priority = (cpu_nice + 20) / 5. -- From ionice(1) man page
144144
*/
145145
static int LinuxProcess_effectiveIOPriority(const LinuxProcess* this) {

solaris/Platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ in the source distribution for its full text.
1212
#include <kstat.h>
1313

1414
/* On OmniOS /usr/include/sys/regset.h redefines ERR to 13 - \r, breaking the Enter key.
15-
* Since ncruses macros use the ERR macro, we cannot use another name.
15+
* Since ncurses macros use the ERR macro, we cannot use another name.
1616
*/
1717
#undef ERR
1818
#include <libproc.h>

solaris/SolarisProcess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ in the source distribution for its full text.
1212
#include <sys/proc.h>
1313

1414
/* On OmniOS /usr/include/sys/regset.h redefines ERR to 13 - \r, breaking the Enter key.
15-
* Since ncruses macros use the ERR macro, we cannot use another name.
15+
* Since ncurses macros use the ERR macro, we cannot use another name.
1616
*/
1717
#undef ERR
1818
#include <libproc.h>

0 commit comments

Comments
 (0)