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
b81a5718
Commit
b81a5718
authored
Nov 22, 2022
by
Alex Henrie
Committed by
Alexandre Julliard
Nov 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dnsapi: Use the strdup and wcsdup functions instead of reimplementing them.
parent
7f01fdb6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
31 deletions
+4
-31
dnsapi.h
dlls/dnsapi/dnsapi.h
+0
-27
query.c
dlls/dnsapi/query.c
+1
-1
record.c
dlls/dnsapi/record.c
+3
-3
No files found.
dlls/dnsapi/dnsapi.h
View file @
b81a5718
...
...
@@ -25,33 +25,6 @@
#include "winternl.h"
#include "wine/unixlib.h"
static
inline
char
*
strdup_a
(
const
char
*
src
)
{
char
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
malloc
(
(
lstrlenA
(
src
)
+
1
)
*
sizeof
(
char
)
);
if
(
dst
)
lstrcpyA
(
dst
,
src
);
return
dst
;
}
static
inline
char
*
strdup_u
(
const
char
*
src
)
{
char
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
malloc
(
(
strlen
(
src
)
+
1
)
*
sizeof
(
char
)
);
if
(
dst
)
strcpy
(
dst
,
src
);
return
dst
;
}
static
inline
WCHAR
*
strdup_w
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
dst
=
malloc
(
(
lstrlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
);
if
(
dst
)
lstrcpyW
(
dst
,
src
);
return
dst
;
}
static
inline
WCHAR
*
strdup_aw
(
const
char
*
str
)
{
WCHAR
*
ret
=
NULL
;
...
...
dlls/dnsapi/query.c
View file @
b81a5718
...
...
@@ -73,7 +73,7 @@ static DNS_STATUS do_query_netbios( PCSTR name, DNS_RECORDA **recp )
}
else
{
record
->
pName
=
strdup
_u
(
name
);
record
->
pName
=
strdup
(
name
);
if
(
!
record
->
pName
)
{
status
=
ERROR_NOT_ENOUGH_MEMORY
;
...
...
dlls/dnsapi/record.c
View file @
b81a5718
...
...
@@ -455,7 +455,7 @@ static LPVOID strdupX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
{
switch
(
out
)
{
case
DnsCharSetUnicode
:
return
strdup_w
(
src
);
case
DnsCharSetUnicode
:
return
wcsdup
(
src
);
case
DnsCharSetUtf8
:
return
strdup_wu
(
src
);
case
DnsCharSetAnsi
:
return
strdup_wa
(
src
);
default:
...
...
@@ -468,7 +468,7 @@ static LPVOID strdupX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
switch
(
out
)
{
case
DnsCharSetUnicode
:
return
strdup_uw
(
src
);
case
DnsCharSetUtf8
:
return
strdup
_u
(
src
);
case
DnsCharSetUtf8
:
return
strdup
(
src
);
case
DnsCharSetAnsi
:
return
strdup_ua
(
src
);
default:
WARN
(
"unhandled target charset: %d
\n
"
,
out
);
...
...
@@ -480,7 +480,7 @@ static LPVOID strdupX( LPCVOID src, DNS_CHARSET in, DNS_CHARSET out )
{
case
DnsCharSetUnicode
:
return
strdup_aw
(
src
);
case
DnsCharSetUtf8
:
return
strdup_au
(
src
);
case
DnsCharSetAnsi
:
return
strdup
_a
(
src
);
case
DnsCharSetAnsi
:
return
strdup
(
src
);
default:
WARN
(
"unhandled target charset: %d
\n
"
,
out
);
break
;
...
...
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