global/variables: add g_ prefix to some global variables

Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
chao an 2024-09-02 13:06:25 +08:00 committed by Xiang Xiao
parent 39e873f269
commit 85c39e96d6
2 changed files with 13 additions and 6 deletions

View File

@ -70,6 +70,10 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel,
* Private Data * 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) #if defined(CONFIG_RAMLOG_SYSLOG)
static const struct syslog_channel_ops_s g_ramlog_channel_ops = 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) FAR const char *buffer, size_t buflen)
{ {
#if defined(CONFIG_ARCH_LOWPUTC) #if defined(CONFIG_ARCH_LOWPUTC)
static mutex_t lock = NXMUTEX_INITIALIZER; nxmutex_lock(&g_lowputs_lock);
nxmutex_lock(&lock);
up_nputs(buffer, buflen); up_nputs(buffer, buflen);
nxmutex_unlock(&lock); nxmutex_unlock(&g_lowputs_lock);
#endif #endif
UNUSED(channel); UNUSED(channel);

View File

@ -30,6 +30,12 @@
#include <nuttx/clock.h> #include <nuttx/clock.h>
/****************************************************************************
* Private Data
****************************************************************************/
static struct tm g_gmtime;
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -44,8 +50,7 @@
FAR struct tm *gmtime(FAR const time_t *timep) FAR struct tm *gmtime(FAR const time_t *timep)
{ {
static struct tm tm; return gmtime_r(timep, &g_gmtime);
return gmtime_r(timep, &tm);
} }
FAR struct tm *localtime(FAR const time_t *timep) FAR struct tm *localtime(FAR const time_t *timep)