Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
55b18b14
Commit
55b18b14
authored
Nov 21, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Factor out wenv_get_index helper.
parent
ca7a1139
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
14 deletions
+17
-14
environ.c
dlls/msvcrt/environ.c
+17
-14
No files found.
dlls/msvcrt/environ.c
View file @
55b18b14
...
...
@@ -38,6 +38,19 @@ static int env_get_index(const char *name)
return
i
;
}
static
int
wenv_get_index
(
const
wchar_t
*
name
)
{
int
i
,
len
;
len
=
wcslen
(
name
);
for
(
i
=
0
;
MSVCRT__wenviron
[
i
];
i
++
)
{
if
(
!
wcsncmp
(
name
,
MSVCRT__wenviron
[
i
],
len
)
&&
MSVCRT__wenviron
[
i
][
len
]
==
'='
)
return
i
;
}
return
i
;
}
static
char
*
getenv_helper
(
const
char
*
name
)
{
int
idx
;
...
...
@@ -61,27 +74,17 @@ char * CDECL getenv(const char *name)
static
wchar_t
*
wgetenv_helper
(
const
wchar_t
*
name
)
{
wchar_t
**
env
;
size_t
len
;
int
idx
;
if
(
!
name
)
return
NULL
;
len
=
wcslen
(
name
);
/* Initialize the _wenviron array if it's not already created. */
if
(
!
MSVCRT__wenviron
)
MSVCRT__wenviron
=
msvcrt_SnapshotOfEnvironmentW
(
NULL
);
for
(
env
=
MSVCRT__wenviron
;
*
env
;
env
++
)
{
wchar_t
*
str
=
*
env
;
wchar_t
*
pos
=
wcschr
(
str
,
'='
);
if
(
pos
&&
((
pos
-
str
)
==
len
)
&&
!
_wcsnicmp
(
str
,
name
,
len
))
{
TRACE
(
"(%s): got %s
\n
"
,
debugstr_w
(
name
),
debugstr_w
(
pos
+
1
));
return
pos
+
1
;
}
}
return
NULL
;
idx
=
wenv_get_index
(
name
);
if
(
!
MSVCRT__wenviron
[
idx
])
return
NULL
;
return
wcschr
(
MSVCRT__wenviron
[
idx
],
'='
)
+
1
;
}
/*********************************************************************
...
...
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