]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
signal-util: don't introduce symbols with double underscores
authorLennart Poettering <lennart@poettering.net>
Mon, 11 Oct 2021 11:18:50 +0000 (13:18 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 11 Oct 2021 12:08:58 +0000 (14:08 +0200)
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.

src/basic/signal-util.c

index 34b2b279189230a8247abd5db0ee1c62f48c6661..f945a96f0de0aeb63ca22166ab14a45a6a18465b 100644 (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;