Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
spdlog
Commits
ad725d34
Unverified
Commit
ad725d34
authored
Jun 09, 2025
by
电线杆
Committed by
GitHub
Jun 08, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use std::getenv #3414 (#3415)
parent
e655dbb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
include/spdlog/cfg/helpers-inl.h
+1
-1
include/spdlog/details/os-inl.h
+10
-10
No files found.
include/spdlog/cfg/helpers-inl.h
View file @
ad725d34
...
@@ -71,7 +71,7 @@ inline std::unordered_map<std::string, std::string> extract_key_vals_(const std:
...
@@ -71,7 +71,7 @@ inline std::unordered_map<std::string, std::string> extract_key_vals_(const std:
}
}
SPDLOG_INLINE
void
load_levels
(
const
std
::
string
&
input
)
{
SPDLOG_INLINE
void
load_levels
(
const
std
::
string
&
input
)
{
if
(
input
.
empty
()
||
input
.
size
()
>
512
)
{
if
(
input
.
empty
()
||
input
.
size
()
>
=
32768
)
{
return
;
return
;
}
}
...
...
include/spdlog/details/os-inl.h
View file @
ad725d34
...
@@ -563,21 +563,21 @@ SPDLOG_INLINE filename_t dir_name(const filename_t &path) {
...
@@ -563,21 +563,21 @@ SPDLOG_INLINE filename_t dir_name(const filename_t &path) {
return
pos
!=
filename_t
::
npos
?
path
.
substr
(
0
,
pos
)
:
filename_t
{};
return
pos
!=
filename_t
::
npos
?
path
.
substr
(
0
,
pos
)
:
filename_t
{};
}
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4996)
#endif // _MSC_VER
std
::
string
SPDLOG_INLINE
getenv
(
const
char
*
field
)
{
std
::
string
SPDLOG_INLINE
getenv
(
const
char
*
field
)
{
#if defined(_MSC_VER)
#if defined(_MSC_VER) && defined(__cplusplus_winrt)
#if defined(__cplusplus_winrt)
return
std
::
string
{};
// not supported under uwp
return
std
::
string
{};
// not supported under uwp
#else
#else
size_t
len
=
0
;
char
*
buf
=
std
::
getenv
(
field
);
char
buf
[
128
];
bool
ok
=
::
getenv_s
(
&
len
,
buf
,
sizeof
(
buf
),
field
)
==
0
;
return
ok
?
buf
:
std
::
string
{};
#endif
#else // revert to getenv
char
*
buf
=
::
getenv
(
field
);
return
buf
?
buf
:
std
::
string
{};
return
buf
?
buf
:
std
::
string
{};
#endif
#endif
}
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif // _MSC_VER
// Do fsync by FILE handlerpointer
// Do fsync by FILE handlerpointer
// Return true on success
// Return true on success
...
...
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