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
62f9bd39
Commit
62f9bd39
authored
Feb 08, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: Consistently use xmalloc/xrealloc/xstrdup everywhere.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
78ef8cf4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
27 deletions
+23
-27
parser.y
tools/widl/parser.y
+3
-3
widl.c
tools/widl/widl.c
+2
-2
msc.c
tools/winedump/msc.c
+2
-4
msmangle.c
tools/winedump/msmangle.c
+0
-2
winegcc.c
tools/winegcc/winegcc.c
+11
-11
wmc.c
tools/wmc/wmc.c
+2
-2
wrc.c
tools/wrc/wrc.c
+3
-3
No files found.
tools/widl/parser.y
View file @
62f9bd39
...
...
@@ -521,7 +521,7 @@ arg_list: arg { check_arg_attrs($1); $$ = append_var( NULL, $1 ); }
;
args: arg_list
| arg_list ',' ELLIPSIS { $$ = append_var( $1, make_var(strdup("...")) ); }
| arg_list ',' ELLIPSIS { $$ = append_var( $1, make_var(
x
strdup("...")) ); }
;
/* split into two rules to get bison to resolve a tVOID conflict */
...
...
@@ -3107,9 +3107,9 @@ static void check_async_uuid(type_t *iface)
if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
{
if (is_attr(arg->attrs, ATTR_IN) || !is_attr(arg->attrs, ATTR_OUT))
begin_args = append_var(begin_args, copy_var(arg, strdup(arg->name), arg_in_attrs));
begin_args = append_var(begin_args, copy_var(arg,
x
strdup(arg->name), arg_in_attrs));
if (is_attr(arg->attrs, ATTR_OUT))
finish_args = append_var(finish_args, copy_var(arg, strdup(arg->name), arg_out_attrs));
finish_args = append_var(finish_args, copy_var(arg,
x
strdup(arg->name), arg_out_attrs));
}
begin_func = copy_var(func, strmake("Begin_%s", func->name), NULL);
...
...
tools/widl/widl.c
View file @
62f9bd39
...
...
@@ -489,8 +489,8 @@ static void init_argv0_dir( const char *argv0 )
#elif defined (__FreeBSD__) || defined(__DragonFly__)
static
int
pathname
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_PATHNAME
,
-
1
};
size_t
path_size
=
PATH_MAX
;
char
*
path
=
malloc
(
path_size
);
if
(
path
&&
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
char
*
path
=
x
malloc
(
path_size
);
if
(
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
dir
=
realpath
(
path
,
NULL
);
free
(
path
);
#else
...
...
tools/winedump/msc.c
View file @
62f9bd39
...
...
@@ -1319,15 +1319,13 @@ static void init_symbol_dumper(struct symbol_dumper* sd)
{
sd
->
depth
=
0
;
sd
->
alloc
=
16
;
sd
->
stack
=
malloc
(
sd
->
alloc
*
sizeof
(
sd
->
stack
[
0
]));
sd
->
stack
=
x
malloc
(
sd
->
alloc
*
sizeof
(
sd
->
stack
[
0
]));
}
static
void
push_symbol_dumper
(
struct
symbol_dumper
*
sd
,
const
union
codeview_symbol
*
sym
,
unsigned
end
)
{
if
(
!
sd
->
stack
)
return
;
if
(
sd
->
depth
>=
sd
->
alloc
&&
!
(
sd
->
stack
=
realloc
(
sd
->
stack
,
(
sd
->
alloc
*=
2
)
*
sizeof
(
sd
->
stack
[
0
]))))
return
;
if
(
sd
->
depth
>=
sd
->
alloc
)
sd
->
stack
=
xrealloc
(
sd
->
stack
,
(
sd
->
alloc
*=
2
)
*
sizeof
(
sd
->
stack
[
0
]));
sd
->
stack
[
sd
->
depth
].
end
=
end
;
sd
->
stack
[
sd
->
depth
].
sym
=
sym
;
sd
->
depth
++
;
...
...
tools/winedump/msmangle.c
View file @
62f9bd39
...
...
@@ -490,8 +490,6 @@ static char *demangle_datatype (char **str, compound_type *ct,
iter
++
;
/* Apply our constraints to the base type (struct xxx *) */
stripped
=
xstrdup
(
sym
->
arg_text
[
0
]);
if
(
!
stripped
)
fatal
(
"Out of Memory"
);
/* If we're a reference, re-use the pointer already in the type */
if
(
!
(
ct
->
flags
&
CT_BY_REFERENCE
))
...
...
tools/winegcc/winegcc.c
View file @
62f9bd39
...
...
@@ -657,8 +657,8 @@ static void init_argv0_dir( const char *argv0 )
#elif defined (__FreeBSD__) || defined(__DragonFly__)
static
int
pathname
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_PATHNAME
,
-
1
};
size_t
path_size
=
PATH_MAX
;
char
*
path
=
malloc
(
path_size
);
if
(
path
&&
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
char
*
path
=
x
malloc
(
path_size
);
if
(
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
dir
=
realpath
(
path
,
NULL
);
free
(
path
);
#else
...
...
@@ -1114,7 +1114,7 @@ static void build(struct options* opts)
* -xlll: lll is the language (c, c++, etc.)
*/
output_file
=
strdup
(
opts
->
output_name
?
opts
->
output_name
:
"a.out"
);
output_file
=
x
strdup
(
opts
->
output_name
?
opts
->
output_name
:
"a.out"
);
/* 'winegcc -o app xxx.exe.so' only creates the load script */
if
(
opts
->
files
.
count
==
1
&&
strendswith
(
opts
->
files
.
str
[
0
],
".exe.so"
))
...
...
@@ -1648,7 +1648,7 @@ int main(int argc, char **argv)
switch
(
opts
.
args
.
str
[
i
][
1
])
{
case
'B'
:
str
=
strdup
(
option_arg
);
str
=
x
strdup
(
option_arg
);
if
(
strendswith
(
str
,
"/"
))
str
[
strlen
(
str
)
-
1
]
=
0
;
strarray_add
(
&
opts
.
prefix
,
str
);
raw_linker_arg
=
1
;
...
...
@@ -1824,17 +1824,17 @@ int main(int argc, char **argv)
{
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--image-base"
)
&&
j
<
Wl
.
count
-
1
)
{
opts
.
image_base
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
image_base
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--section-alignment"
)
&&
j
<
Wl
.
count
-
1
)
{
opts
.
section_align
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
section_align
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--file-alignment"
)
&&
j
<
Wl
.
count
-
1
)
{
opts
.
file_align
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
file_align
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--large-address-aware"
))
...
...
@@ -1849,12 +1849,12 @@ int main(int argc, char **argv)
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--subsystem"
)
&&
j
<
Wl
.
count
-
1
)
{
opts
.
subsystem
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
subsystem
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--entry"
)
&&
j
<
Wl
.
count
-
1
)
{
opts
.
entry_point
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
entry_point
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"-delayload"
)
&&
j
<
Wl
.
count
-
1
)
...
...
@@ -1864,7 +1864,7 @@ int main(int argc, char **argv)
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--debug-file"
)
&&
j
<
Wl
.
count
-
1
)
{
opts
.
debug_file
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
debug_file
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--whole-archive"
)
||
...
...
@@ -1877,7 +1877,7 @@ int main(int argc, char **argv)
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"--out-implib"
))
{
opts
.
out_implib
=
strdup
(
Wl
.
str
[
++
j
]
);
opts
.
out_implib
=
x
strdup
(
Wl
.
str
[
++
j
]
);
continue
;
}
if
(
!
strcmp
(
Wl
.
str
[
j
],
"-static"
))
linking
=
-
1
;
...
...
tools/wmc/wmc.c
View file @
62f9bd39
...
...
@@ -157,8 +157,8 @@ static void init_argv0_dir( const char *argv0 )
#elif defined (__FreeBSD__) || defined(__DragonFly__)
static
int
pathname
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_PATHNAME
,
-
1
};
size_t
path_size
=
PATH_MAX
;
char
*
path
=
malloc
(
path_size
);
if
(
path
&&
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
char
*
path
=
x
malloc
(
path_size
);
if
(
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
dir
=
realpath
(
path
,
NULL
);
free
(
path
);
#else
...
...
tools/wrc/wrc.c
View file @
62f9bd39
...
...
@@ -307,8 +307,8 @@ static void init_argv0_dir( const char *argv0 )
#elif defined (__FreeBSD__) || defined(__DragonFly__)
static
int
pathname
[]
=
{
CTL_KERN
,
KERN_PROC
,
KERN_PROC_PATHNAME
,
-
1
};
size_t
path_size
=
PATH_MAX
;
char
*
path
=
malloc
(
path_size
);
if
(
path
&&
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
char
*
path
=
x
malloc
(
path_size
);
if
(
!
sysctl
(
pathname
,
sizeof
(
pathname
)
/
sizeof
(
pathname
[
0
]),
path
,
&
path_size
,
NULL
,
0
))
dir
=
realpath
(
path
,
NULL
);
free
(
path
);
#else
...
...
@@ -401,7 +401,7 @@ static void option_callback( int optc, char *optarg )
optarg
++
;
/* fall through */
case
'o'
:
if
(
!
output_name
)
output_name
=
strdup
(
optarg
);
if
(
!
output_name
)
output_name
=
x
strdup
(
optarg
);
else
error
(
"Too many output files.
\n
"
);
break
;
case
'O'
:
...
...
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