Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
47006c4e
Commit
47006c4e
authored
May 10, 2017
by
Gabi Melman
Committed by
GitHub
May 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #436 from bahostetterlewis/master
Allow compiler to select an strerror_r stringify
parents
e9b82867
84a4f56e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
include/spdlog/details/os.h
include/spdlog/details/os.h
+13
-1
No files found.
include/spdlog/details/os.h
View file @
47006c4e
...
...
@@ -364,6 +364,17 @@ inline std::string filename_to_str(const filename_t& filename)
}
#endif
inline
std
::
string
errno_to_string
(
char
[
256
],
char
*
res
)
{
return
std
::
string
(
res
);
}
inline
std
::
string
errno_to_string
(
char
buf
[
256
],
int
res
)
{
if
(
res
==
0
)
{
return
std
::
string
(
buf
);
}
else
{
return
"Unknown error"
;
}
}
// Return errno string (thread safe)
inline
std
::
string
errno_str
(
int
err_num
)
...
...
@@ -386,7 +397,8 @@ inline std::string errno_str(int err_num)
return
"Unknown error"
;
#else // gnu version (might not use the given buf, so its retval pointer must be used)
return
std
::
string
(
strerror_r
(
err_num
,
buf
,
buf_size
));
auto
err
=
strerror_r
(
err_num
,
buf
,
buf_size
);
// let compiler choose type
return
errno_to_string
(
buf
,
err
);
// use overloading to select correct stringify function
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment