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
264d8884
Commit
264d8884
authored
Nov 02, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Add strmake() helper.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9240ffbb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
22 deletions
+25
-22
parser.y
tools/widl/parser.y
+4
-20
register.c
tools/widl/register.c
+1
-2
utils.c
tools/widl/utils.c
+19
-0
utils.h
tools/widl/utils.h
+1
-0
No files found.
tools/widl/parser.y
View file @
264d8884
...
...
@@ -2038,11 +2038,8 @@ var_t *find_const(const char *name, int f)
char *gen_name(void)
{
static const char format[] = "__WIDL_%s_generated_name_%08lX";
static unsigned long n = 0;
static const char *file_id;
static size_t size;
char *name;
if (! file_id)
{
...
...
@@ -2052,13 +2049,8 @@ char *gen_name(void)
for (; *dst; ++dst)
if (! isalnum((unsigned char) *dst))
*dst = '_';
size = sizeof format - 7 + strlen(file_id) + 8;
}
name = xmalloc(size);
sprintf(name, format, file_id, n++);
return name;
return strmake("__WIDL_%s_generated_name_%08lX", file_id, n++);
}
struct allowed_attr
...
...
@@ -2727,14 +2719,6 @@ static void check_functions(const type_t *iface, int is_inside_library)
}
}
static char *concat_str(const char *prefix, const char *str)
{
char *ret = xmalloc(strlen(prefix) + strlen(str) + 1);
strcpy(ret, prefix);
strcat(ret, str);
return ret;
}
static int async_iface_attrs(attr_list_t *attrs, const attr_t *attr)
{
switch(attr->type)
...
...
@@ -2774,7 +2758,7 @@ static void check_async_uuid(type_t *iface)
if (!inherit)
error_loc("async_uuid applied to an interface with incompatible parent\n");
async_iface = get_type(TYPE_INTERFACE,
concat_str("Async
", iface->name), iface->namespace, 0);
async_iface = get_type(TYPE_INTERFACE,
strmake("Async%s
", iface->name), iface->namespace, 0);
async_iface->attrs = map_attrs(iface->attrs, async_iface_attrs);
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
...
...
@@ -2791,13 +2775,13 @@ static void check_async_uuid(type_t *iface)
finish_args = append_var(finish_args, copy_var(arg, strdup(arg->name), arg_out_attrs));
}
begin_func = copy_var(func,
concat_str("Begin_
", func->name), NULL);
begin_func = copy_var(func,
strmake("Begin_%s
", func->name), NULL);
begin_func->declspec.type = type_new_function(begin_args);
begin_func->declspec.type->attrs = func->attrs;
begin_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
stmts = append_statement(stmts, make_statement_declaration(begin_func));
finish_func = copy_var(func,
concat_str("Finish_
", func->name), NULL);
finish_func = copy_var(func,
strmake("Finish_%s
", func->name), NULL);
finish_func->declspec.type = type_new_function(finish_args);
finish_func->declspec.type->attrs = func->attrs;
finish_func->declspec.type->details.function->retval = func->declspec.type->details.function->retval;
...
...
tools/widl/register.c
View file @
264d8884
...
...
@@ -321,8 +321,7 @@ void output_typelib_regscript( const typelib_t *typelib )
if
(
expr
)
{
sprintf
(
id_part
,
"
\\
%d"
,
expr
->
cval
);
resname
=
xmalloc
(
strlen
(
typelib_name
)
+
20
);
sprintf
(
resname
,
"%s
\\
%d"
,
typelib_name
,
expr
->
cval
);
resname
=
strmake
(
"%s
\\
%d"
,
typelib_name
,
expr
->
cval
);
}
put_str
(
indent
,
"'%x' { %s = s '%%MODULE%%%s' }
\n
"
,
lcid_expr
?
lcid_expr
->
cval
:
0
,
pointer_size
==
8
?
"win64"
:
"win32"
,
id_part
);
...
...
tools/widl/utils.c
View file @
264d8884
...
...
@@ -226,6 +226,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/widl/utils.h
View file @
264d8884
...
...
@@ -44,6 +44,7 @@ void error_loc_info(const loc_info_t *, const char *s, ...) __attribute__((forma
void
warning
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
void
warning_loc_info
(
const
loc_info_t
*
,
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
2
,
3
)));
void
chat
(
const
char
*
s
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
char
*
strmake
(
const
char
*
fmt
,
...)
__attribute__
((
__format__
(
__printf__
,
1
,
2
)));
char
*
dup_basename
(
const
char
*
name
,
const
char
*
ext
);
size_t
widl_getline
(
char
**
linep
,
size_t
*
lenp
,
FILE
*
fp
);
...
...
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