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
46ecc16d
Commit
46ecc16d
authored
Jan 24, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmc: Add a copy of the strmake utility function.
parent
86eb9c24
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
utils.c
tools/wmc/utils.c
+19
-2
utils.h
tools/wmc/utils.h
+1
-0
No files found.
tools/wmc/utils.c
View file @
46ecc16d
...
...
@@ -138,7 +138,6 @@ void *xmalloc(size_t size)
void
*
res
;
assert
(
size
>
0
);
assert
(
size
<
102400
);
res
=
malloc
(
size
);
if
(
res
==
NULL
)
{
...
...
@@ -154,7 +153,6 @@ void *xrealloc(void *p, size_t size)
void
*
res
;
assert
(
size
>
0
);
assert
(
size
<
102400
);
res
=
realloc
(
p
,
size
);
if
(
res
==
NULL
)
{
...
...
@@ -172,6 +170,25 @@ char *xstrdup(const char *str)
return
strcpy
(
s
,
str
);
}
char
*
strmake
(
const
char
*
fmt
,
...
)
{
int
n
;
size_t
size
=
100
;
va_list
ap
;
for
(;;)
{
char
*
p
=
xmalloc
(
size
);
va_start
(
ap
,
fmt
);
n
=
vsnprintf
(
p
,
size
,
fmt
,
ap
);
va_end
(
ap
);
if
(
n
==
-
1
)
size
*=
2
;
else
if
((
size_t
)
n
>=
size
)
size
=
n
+
1
;
else
return
p
;
free
(
p
);
}
}
int
unistrlen
(
const
WCHAR
*
s
)
{
int
n
;
...
...
tools/wmc/utils.h
View file @
46ecc16d
...
...
@@ -33,6 +33,7 @@ char *xstrdup(const char *str);
#define __attribute__(X)
#endif
char
*
strmake
(
const
char
*
fmt
,
...)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
int
mcy_error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
xyyerror
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
mcy_warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
...
...
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