Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libdap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
cellframe
libdap
Commits
d337cb2d
Commit
d337cb2d
authored
5 years ago
by
alexander.lysikov
Browse files
Options
Downloads
Patches
Plain Diff
replaced localtime() to thread save function localtime_r()
parent
4ab41cdc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dap_common.c
+6
-4
6 additions, 4 deletions
src/dap_common.c
with
6 additions
and
4 deletions
src/dap_common.c
+
6
−
4
View file @
d337cb2d
...
...
@@ -120,7 +120,7 @@ int dap_common_init(const char * a_log_file)
}
// Set max items in log list
dap_log_set_max_item
(
10
);
dap_log_set_max_item
(
10
0
);
return
0
;
}
...
...
@@ -290,7 +290,9 @@ void _vlog_it(const char * log_tag,enum dap_log_level ll, const char * format,va
va_copy
(
ap2
,
ap
);
va_copy
(
ap3
,
ap
);
time_t
t
=
time
(
NULL
);
struct
tm
*
tmp
=
localtime
(
&
t
);
struct
tm
l_tmp
;
struct
tm
*
tmp
=
localtime_r
(
&
t
,
&
l_tmp
);
// thread save function
static
char
s_time
[
1024
]
=
{
0
};
strftime
(
s_time
,
sizeof
(
s_time
),
"%x-%X"
,
tmp
);
...
...
@@ -299,7 +301,7 @@ void _vlog_it(const char * log_tag,enum dap_log_level ll, const char * format,va
if
(
ll
==
L_DEBUG
){
if
(
s_log_file
)
fprintf
(
s_log_file
,
"[DBG] "
);
printf
(
"
\x1b
[37;2m[DBG] "
);
printf
(
"
\x1b
[37;2m[DBG] "
);
}
else
if
(
ll
==
L_INFO
){
if
(
s_log_file
)
fprintf
(
s_log_file
,
"[INF] "
);
printf
(
"
\x1b
[32;2m[INF] "
);
...
...
@@ -323,7 +325,7 @@ void _vlog_it(const char * log_tag,enum dap_log_level ll, const char * format,va
if
(
s_log_file
)
vfprintf
(
s_log_file
,
format
,
ap
);
vprintf
(
format
,
ap2
);
if
(
s_log_file
)
fprintf
(
s_log_file
,
"
\n
"
);
printf
(
"
\
x1b
[0m
\
n
"
);
printf
(
"
\n
"
);
va_end
(
ap2
);
// save log to list
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment