Skip to content

Commit 85c39e9

Browse files
anchaoxiaoxiang781216
authored andcommitted
global/variables: add g_ prefix to some global variables
Signed-off-by: chao an <[email protected]>
1 parent 39e873f commit 85c39e9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

drivers/syslog/syslog_channel.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel,
7070
* Private Data
7171
****************************************************************************/
7272

73+
#if defined(CONFIG_SYSLOG_DEFAULT) && defined(CONFIG_ARCH_LOWPUTC)
74+
static mutex_t g_lowputs_lock = NXMUTEX_INITIALIZER;
75+
#endif
76+
7377
#if defined(CONFIG_RAMLOG_SYSLOG)
7478
static const struct syslog_channel_ops_s g_ramlog_channel_ops =
7579
{
@@ -236,13 +240,11 @@ static ssize_t syslog_default_write(FAR struct syslog_channel_s *channel,
236240
FAR const char *buffer, size_t buflen)
237241
{
238242
#if defined(CONFIG_ARCH_LOWPUTC)
239-
static mutex_t lock = NXMUTEX_INITIALIZER;
240-
241-
nxmutex_lock(&lock);
243+
nxmutex_lock(&g_lowputs_lock);
242244

243245
up_nputs(buffer, buflen);
244246

245-
nxmutex_unlock(&lock);
247+
nxmutex_unlock(&g_lowputs_lock);
246248
#endif
247249

248250
UNUSED(channel);

libs/libc/time/lib_gmtime.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030

3131
#include <nuttx/clock.h>
3232

33+
/****************************************************************************
34+
* Private Data
35+
****************************************************************************/
36+
37+
static struct tm g_gmtime;
38+
3339
/****************************************************************************
3440
* Public Functions
3541
****************************************************************************/
@@ -44,8 +50,7 @@
4450

4551
FAR struct tm *gmtime(FAR const time_t *timep)
4652
{
47-
static struct tm tm;
48-
return gmtime_r(timep, &tm);
53+
return gmtime_r(timep, &g_gmtime);
4954
}
5055

5156
FAR struct tm *localtime(FAR const time_t *timep)

0 commit comments

Comments
 (0)