mirror of
https://github.com/xzeldon/htop.git
synced 2025-07-14 13:04:35 +03:00
Mark signal tables 'const'
Specifically, Platform_signals[] and Platform_numberOfSignals. Both are not supposed to be mutable. Marking them 'const' puts them into rodata sections in binary. And for Platform_numberOfSignals, this aids optimization (aids only Link Time Optimization for now). :) Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
This commit is contained in:
@ -99,7 +99,7 @@ int Platform_numberOfFields = LAST_PROCESSFIELD;
|
||||
/*
|
||||
* See /usr/include/sys/signal.h
|
||||
*/
|
||||
SignalItem Platform_signals[] = {
|
||||
const SignalItem Platform_signals[] = {
|
||||
{ .name = " 0 Cancel", .number = 0 },
|
||||
{ .name = " 1 SIGHUP", .number = 1 },
|
||||
{ .name = " 2 SIGINT", .number = 2 },
|
||||
@ -136,7 +136,7 @@ SignalItem Platform_signals[] = {
|
||||
{ .name = "32 SIGTHR", .number = 32 },
|
||||
};
|
||||
|
||||
unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
|
||||
const unsigned int Platform_numberOfSignals = sizeof(Platform_signals)/sizeof(SignalItem);
|
||||
|
||||
void Platform_setBindings(Htop_Action* keys) {
|
||||
(void) keys;
|
||||
|
@ -39,9 +39,9 @@ extern int Platform_numberOfFields;
|
||||
/*
|
||||
* See /usr/include/sys/signal.h
|
||||
*/
|
||||
extern SignalItem Platform_signals[];
|
||||
extern const SignalItem Platform_signals[];
|
||||
|
||||
extern unsigned int Platform_numberOfSignals;
|
||||
extern const unsigned int Platform_numberOfSignals;
|
||||
|
||||
void Platform_setBindings(Htop_Action* keys);
|
||||
|
||||
|
Reference in New Issue
Block a user