From 85c39e96d6334a864d4f41de78472fc9f872bb6b Mon Sep 17 00:00:00 2001 From: chao an Date: Mon, 2 Sep 2024 13:06:25 +0800 Subject: [PATCH] global/variables: add g_ prefix to some global variables Signed-off-by: chao an --- drivers/syslog/syslog_channel.c | 10 ++++++---- libs/libc/time/lib_gmtime.c | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c index 73b243ad64..7a3481a472 100644 --- a/drivers/syslog/syslog_channel.c +++ b/drivers/syslog/syslog_channel.c @@ -70,6 +70,10 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel, * Private Data ****************************************************************************/ +#if defined(CONFIG_SYSLOG_DEFAULT) && defined(CONFIG_ARCH_LOWPUTC) +static mutex_t g_lowputs_lock = NXMUTEX_INITIALIZER; +#endif + #if defined(CONFIG_RAMLOG_SYSLOG) static const struct syslog_channel_ops_s g_ramlog_channel_ops = { @@ -236,13 +240,11 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel, FAR const char *buffer, size_t buflen) { #if defined(CONFIG_ARCH_LOWPUTC) - static mutex_t lock = NXMUTEX_INITIALIZER; - - nxmutex_lock(&lock); + nxmutex_lock(&g_lowputs_lock); up_nputs(buffer, buflen); - nxmutex_unlock(&lock); + nxmutex_unlock(&g_lowputs_lock); #endif UNUSED(channel); diff --git a/libs/libc/time/lib_gmtime.c b/libs/libc/time/lib_gmtime.c index fb6a567775..e98b1600ce 100644 --- a/libs/libc/time/lib_gmtime.c +++ b/libs/libc/time/lib_gmtime.c @@ -30,6 +30,12 @@ #include +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct tm g_gmtime; + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -44,8 +50,7 @@ FAR struct tm *gmtime(FAR const time_t *timep) { - static struct tm tm; - return gmtime_r(timep, &tm); + return gmtime_r(timep, &g_gmtime); } FAR struct tm *localtime(FAR const time_t *timep)