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
a6909fa5
Commit
a6909fa5
authored
Jan 31, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Jan 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widl: Eliminate redundant callback routines.
Add a function for comparing expressions and use it to eliminate redundant callback functions.
parent
14e4a545
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
12 deletions
+71
-12
typegen.c
tools/widl/typegen.c
+71
-12
No files found.
tools/widl/typegen.c
View file @
a6909fa5
...
...
@@ -62,6 +62,52 @@ struct expr_eval_routine
static
size_t
type_memsize
(
const
type_t
*
t
,
int
ptr_level
,
const
expr_t
*
array
);
static
size_t
fields_memsize
(
const
var_t
*
v
);
static
int
compare_expr
(
const
expr_t
*
a
,
const
expr_t
*
b
)
{
int
ret
;
if
(
a
->
type
!=
b
->
type
)
return
a
->
type
-
b
->
type
;
switch
(
a
->
type
)
{
case
EXPR_NUM
:
case
EXPR_HEXNUM
:
return
a
->
u
.
lval
-
b
->
u
.
lval
;
case
EXPR_IDENTIFIER
:
return
strcmp
(
a
->
u
.
sval
,
b
->
u
.
sval
);
case
EXPR_COND
:
ret
=
compare_expr
(
a
->
ref
,
b
->
ref
);
if
(
ret
!=
0
)
return
ret
;
ret
=
compare_expr
(
a
->
u
.
ext
,
b
->
u
.
ext
);
if
(
ret
!=
0
)
return
ret
;
return
compare_expr
(
a
->
ext2
,
b
->
ext2
);
case
EXPR_OR
:
case
EXPR_AND
:
case
EXPR_ADD
:
case
EXPR_SUB
:
case
EXPR_MUL
:
case
EXPR_DIV
:
case
EXPR_SHL
:
case
EXPR_SHR
:
ret
=
compare_expr
(
a
->
ref
,
b
->
ref
);
if
(
ret
!=
0
)
return
ret
;
return
compare_expr
(
a
->
u
.
ext
,
b
->
u
.
ext
);
case
EXPR_NOT
:
case
EXPR_NEG
:
case
EXPR_PPTR
:
case
EXPR_CAST
:
case
EXPR_SIZEOF
:
return
compare_expr
(
a
->
ref
,
b
->
ref
);
case
EXPR_VOID
:
return
0
;
}
return
-
1
;
}
static
int
print_file
(
FILE
*
file
,
int
indent
,
const
char
*
format
,
...)
{
va_list
va
;
...
...
@@ -382,21 +428,31 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
else
{
unsigned
int
callback_offset
=
0
;
struct
list
*
cursor
;
LIST_FOR_EACH
(
cursor
,
&
expr_eval_routines
)
callback_offset
++
;
if
(
callback_offset
>
USHRT_MAX
)
error
(
"Maximum number of callback routines reached
\n
"
);
if
(
structure
)
{
struct
expr_eval_routine
*
eval
=
xmalloc
(
sizeof
(
*
eval
));
eval
->
structure
=
structure
;
eval
->
structure_size
=
fields_memsize
(
structure
->
fields
);
eval
->
expr
=
expr
;
list_add_tail
(
&
expr_eval_routines
,
&
eval
->
entry
);
struct
expr_eval_routine
*
eval
;
int
found
=
0
;
LIST_FOR_EACH_ENTRY
(
eval
,
&
expr_eval_routines
,
struct
expr_eval_routine
,
entry
)
{
if
(
!
strcmp
(
eval
->
structure
->
name
,
structure
->
name
)
&&
!
compare_expr
(
eval
->
expr
,
expr
))
{
found
=
1
;
break
;
}
callback_offset
++
;
}
if
(
!
found
)
{
eval
=
xmalloc
(
sizeof
(
*
eval
));
eval
->
structure
=
structure
;
eval
->
structure_size
=
fields_memsize
(
structure
->
fields
);
eval
->
expr
=
expr
;
list_add_tail
(
&
expr_eval_routines
,
&
eval
->
entry
);
}
correlation_type
=
RPC_FC_NORMAL_CONFORMANCE
;
}
...
...
@@ -406,6 +462,9 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_
correlation_type
=
RPC_FC_TOP_LEVEL_CONFORMANCE
;
}
if
(
callback_offset
>
USHRT_MAX
)
error
(
"Maximum number of callback routines reached
\n
"
);
print_file
(
file
,
2
,
"0x%x, /* Corr desc: %s */
\n
"
,
correlation_type
,
correlation_type
==
RPC_FC_TOP_LEVEL_CONFORMANCE
?
"parameter"
:
""
);
...
...
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