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
5fabc5cc
Commit
5fabc5cc
authored
Dec 29, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrc: Copy the strmake utility function from winegcc.
parent
18a3b3f2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
23 deletions
+23
-23
genres.c
tools/wrc/genres.c
+2
-17
utils.c
tools/wrc/utils.c
+19
-0
utils.h
tools/wrc/utils.h
+1
-0
wrc.c
tools/wrc/wrc.c
+1
-6
No files found.
tools/wrc/genres.c
View file @
5fabc5cc
...
...
@@ -1741,23 +1741,8 @@ char *prep_nid_for_label(const name_id_t *nid)
*/
char
*
make_c_name
(
const
char
*
base
,
const
name_id_t
*
nid
,
const
language_t
*
lan
)
{
int
nlen
;
char
*
buf
;
char
*
ret
;
char
lanbuf
[
6
];
sprintf
(
lanbuf
,
"%d"
,
lan
?
MAKELANGID
(
lan
->
id
,
lan
->
sub
)
:
0
);
buf
=
prep_nid_for_label
(
nid
);
nlen
=
strlen
(
buf
)
+
strlen
(
lanbuf
);
nlen
+=
strlen
(
base
)
+
4
;
/* three time '_' and '\0' */
ret
=
xmalloc
(
nlen
);
strcpy
(
ret
,
"_"
);
strcat
(
ret
,
base
);
strcat
(
ret
,
"_"
);
strcat
(
ret
,
buf
);
strcat
(
ret
,
"_"
);
strcat
(
ret
,
lanbuf
);
return
ret
;
char
*
buf
=
prep_nid_for_label
(
nid
);
return
strmake
(
"_%s_%s_%d"
,
base
,
buf
,
lan
?
MAKELANGID
(
lan
->
id
,
lan
->
sub
)
:
0
);
}
/*
...
...
tools/wrc/utils.c
View file @
5fabc5cc
...
...
@@ -192,6 +192,25 @@ void *xrealloc(void *p, size_t size)
return
res
;
}
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
);
}
}
char
*
xstrdup
(
const
char
*
str
)
{
char
*
s
;
...
...
tools/wrc/utils.h
View file @
5fabc5cc
...
...
@@ -33,6 +33,7 @@ char *xstrdup(const char *str);
#define __attribute__(X)
#endif
char
*
strmake
(
const
char
*
fmt
,
...)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
int
parser_error
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
int
parser_warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
internal_error
(
const
char
*
file
,
int
line
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
3
,
4
),
noreturn
));
...
...
tools/wrc/wrc.c
View file @
5fabc5cc
...
...
@@ -270,12 +270,7 @@ static int load_file( const char *input_name, const char *output_name )
exit
(
0
);
}
if
(
output_name
&&
output_name
[
0
])
{
name
=
xmalloc
(
strlen
(
output_name
)
+
8
);
strcpy
(
name
,
output_name
);
strcat
(
name
,
".XXXXXX"
);
}
if
(
output_name
&&
output_name
[
0
])
name
=
strmake
(
"%s.XXXXXX"
,
output_name
);
else
name
=
xstrdup
(
"wrc.XXXXXX"
);
if
((
fd
=
mkstemps
(
name
,
0
))
==
-
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