diff options
author | Explorer09 <explorer09@gmail.com> | 2016-08-30 20:41:17 +0800 |
---|---|---|
committer | Explorer09 <explorer09@gmail.com> | 2016-08-30 20:41:17 +0800 |
commit | 1f3d85b6174f690a7e354bbadac19404d5e75e78 (patch) | |
tree | 1d3b0d1348fe16ab51eb873bd567dc6f876b6411 /freebsd | |
parent | cceab15b9dbdc2f0914c8d479cefa429d1c0daaf (diff) |
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>
Diffstat (limited to 'freebsd')
-rw-r--r-- | freebsd/Platform.c | 4 | ||||
-rw-r--r-- | freebsd/Platform.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/freebsd/Platform.c b/freebsd/Platform.c index f02daa5a..5dd6ca41 100644 --- a/freebsd/Platform.c +++ b/freebsd/Platform.c @@ -43,7 +43,7 @@ ProcessField Platform_defaultFields[] = { PID, USER, PRIORITY, NICE, M_SIZE, M_R int Platform_numberOfFields = LAST_PROCESSFIELD; -SignalItem Platform_signals[] = { +const SignalItem Platform_signals[] = { { .name = " 0 Cancel", .number = 0 }, { .name = " 1 SIGHUP", .number = 1 }, { .name = " 2 SIGINT", .number = 2 }, @@ -80,7 +80,7 @@ SignalItem Platform_signals[] = { { .name = "33 SIGLIBRT", .number = 33 }, }; -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; diff --git a/freebsd/Platform.h b/freebsd/Platform.h index ecc0dcd4..1735e7e3 100644 --- a/freebsd/Platform.h +++ b/freebsd/Platform.h @@ -24,9 +24,9 @@ extern ProcessField Platform_defaultFields[]; extern int Platform_numberOfFields; -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); |