signal-util: don't introduce symbols with double underscores

ANSI C reserves identifiers beginning with an underscore for compiler
internal stuff. We already invade that namespace plenty and probably
should not. But even going for the doubly underscore prefixed namespace
is a bit too much. Let's just rename the offending table as
"static_signal_table[]", since it lists the static defined signals
rather than the "dynamic" RTSIGMIN/RTSIGMAX signals.
This commit is contained in:
Lennart Poettering
2021-10-11 14:08:58 +02:00
parent b1967fb83a
commit f8cc16fd53
+4 -4
View File
@@ -119,7 +119,7 @@ int sigprocmask_many(int how, sigset_t *old, ...) {
return 0;
}
static const char *const __signal_table[] = {
static const char *const static_signal_table[] = {
[SIGHUP] = "HUP",
[SIGINT] = "INT",
[SIGQUIT] = "QUIT",
@@ -155,13 +155,13 @@ static const char *const __signal_table[] = {
[SIGSYS] = "SYS"
};
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(__signal, int);
DEFINE_PRIVATE_STRING_TABLE_LOOKUP(static_signal, int);
const char *signal_to_string(int signo) {
static thread_local char buf[STRLEN("RTMIN+") + DECIMAL_STR_MAX(int)];
const char *name;
name = __signal_to_string(signo);
name = static_signal_to_string(signo);
if (name)
return name;
@@ -190,7 +190,7 @@ int signal_from_string(const char *s) {
s += 3;
/* Check that the input is a signal name. */
signo = __signal_from_string(s);
signo = static_signal_from_string(s);
if (signo > 0)
return signo;