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
506bdf42
Commit
506bdf42
authored
Dec 03, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wpp: Use standard Wine lists where possible.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
de2f4cee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
69 deletions
+37
-69
ppl.l
libs/wpp/ppl.l
+3
-7
preproc.c
libs/wpp/preproc.c
+23
-49
wpp.c
libs/wpp/wpp.c
+7
-8
wpp_private.h
libs/wpp/wpp_private.h
+4
-5
No files found.
libs/wpp/ppl.l
View file @
506bdf42
...
...
@@ -302,7 +302,7 @@ include_state_t pp_incl_state =
0 /* seen_junk */
};
includelogicentry_t *pp_includelogiclist = NULL
;
struct list pp_includelogiclist = LIST_INIT( pp_includelogiclist )
;
#define YY_INPUT(buf,result,max_size) \
{ \
...
...
@@ -1350,11 +1350,7 @@ static bufferstackentry_t *pop_buffer(void)
iep->ppp = ppp;
ppp->iep = iep;
iep->filename = bufferstack[bufferstackidx].include_filename;
iep->prev = NULL;
iep->next = pp_includelogiclist;
if(iep->next)
iep->next->prev = iep;
pp_includelogiclist = iep;
list_add_head( &pp_includelogiclist, &iep->entry );
if(pp_status.debug)
fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n",
bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename);
...
...
@@ -1557,7 +1553,7 @@ void pp_do_include(char *fname, int type)
if(!fname)
return;
for(iep = pp_includelogiclist; iep; iep = iep->next
)
LIST_FOR_EACH_ENTRY( iep, &pp_includelogiclist, includelogicentry_t, entry
)
{
if(!strcmp(iep->filename, fname))
{
...
...
libs/wpp/preproc.c
View file @
506bdf42
...
...
@@ -39,10 +39,11 @@ struct pp_status pp_status;
typedef
struct
pp_def_state
{
struct
pp_def_state
*
next
;
pp_entry_t
*
defines
[
HASHKEY
];
struct
list
entry
;
struct
list
defines
[
HASHKEY
];
}
pp_def_state_t
;
static
struct
list
pp_states
=
LIST_INIT
(
pp_states
);
static
pp_def_state_t
*
pp_def_state
;
#define MAXIFSTACK 64
...
...
@@ -56,14 +57,11 @@ void pp_print_status(void)
int i;
int sum;
int total = 0;
pp_entry_t *ppp;
fprintf(stderr, "Defines statistics:\n");
for(i = 0; i < HASHKEY; i++)
{
sum = 0;
for(ppp = pp_def_state->defines[i]; ppp; ppp = ppp->next)
sum++;
sum = list_count( &pp_def_state->defines[i] );
total += sum;
if (sum) fprintf(stderr, "%4d, %3d\n", i, sum);
}
...
...
@@ -188,7 +186,7 @@ pp_entry_t *pplookup(const char *ident)
if
(
!
ident
)
return
NULL
;
idx
=
pphash
(
ident
);
for
(
ppp
=
pp_def_state
->
defines
[
idx
];
ppp
;
ppp
=
ppp
->
next
)
LIST_FOR_EACH_ENTRY
(
ppp
,
&
pp_def_state
->
defines
[
idx
],
pp_entry_t
,
entry
)
{
if
(
!
strcmp
(
ident
,
ppp
->
ident
))
return
ppp
;
...
...
@@ -200,35 +198,11 @@ static void free_pp_entry( pp_entry_t *ppp, int idx )
{
if
(
ppp
->
iep
)
{
if
(
ppp
->
iep
==
pp_includelogiclist
)
{
pp_includelogiclist
=
ppp
->
iep
->
next
;
if
(
pp_includelogiclist
)
pp_includelogiclist
->
prev
=
NULL
;
}
else
{
ppp
->
iep
->
prev
->
next
=
ppp
->
iep
->
next
;
if
(
ppp
->
iep
->
next
)
ppp
->
iep
->
next
->
prev
=
ppp
->
iep
->
prev
;
}
list_remove
(
&
ppp
->
iep
->
entry
);
free
(
ppp
->
iep
->
filename
);
free
(
ppp
->
iep
);
}
if
(
pp_def_state
->
defines
[
idx
]
==
ppp
)
{
pp_def_state
->
defines
[
idx
]
=
ppp
->
next
;
if
(
pp_def_state
->
defines
[
idx
])
pp_def_state
->
defines
[
idx
]
->
prev
=
NULL
;
}
else
{
ppp
->
prev
->
next
=
ppp
->
next
;
if
(
ppp
->
next
)
ppp
->
next
->
prev
=
ppp
->
prev
;
}
list_remove
(
&
ppp
->
entry
);
free
(
ppp
);
}
...
...
@@ -236,9 +210,10 @@ static void free_pp_entry( pp_entry_t *ppp, int idx )
void
pp_push_define_state
(
void
)
{
pp_def_state_t
*
state
=
pp_xmalloc
(
sizeof
(
*
state
)
);
int
i
;
memset
(
state
->
defines
,
0
,
sizeof
(
state
->
defines
)
);
state
->
next
=
pp_def_state
;
for
(
i
=
0
;
i
<
HASHKEY
;
i
++
)
list_init
(
&
state
->
defines
[
i
]
);
list_add_head
(
&
pp_states
,
&
state
->
entry
)
;
pp_def_state
=
state
;
}
...
...
@@ -246,16 +221,22 @@ void pp_push_define_state(void)
void
pp_pop_define_state
(
void
)
{
int
i
;
pp_entry_t
*
ppp
;
pp_def_state_t
*
state
;
pp_entry_t
*
ppp
,
*
ppp2
;
pp_def_state_t
*
state
=
pp_def_state
;
for
(
i
=
0
;
i
<
HASHKEY
;
i
++
)
{
while
((
ppp
=
pp_def_state
->
defines
[
i
])
!=
NULL
)
pp_del_define
(
ppp
->
ident
);
LIST_FOR_EACH_ENTRY_SAFE
(
ppp
,
ppp2
,
&
state
->
defines
[
i
],
pp_entry_t
,
entry
)
{
free
(
ppp
->
ident
);
free
(
ppp
->
subst
.
text
);
free
(
ppp
->
filename
);
free_pp_entry
(
ppp
,
i
);
}
}
state
=
pp_def_state
;
pp_def_state
=
state
->
next
;
list_remove
(
&
state
->
entry
);
free
(
state
);
pp_def_state
=
LIST_ENTRY
(
list_head
(
&
pp_states
),
pp_def_state_t
,
entry
);
}
void
pp_del_define
(
const
char
*
name
)
...
...
@@ -300,10 +281,7 @@ pp_entry_t *pp_add_define(const char *def, const char *text)
ppp
->
subst
.
text
=
text
?
pp_xstrdup
(
text
)
:
NULL
;
ppp
->
filename
=
pp_xstrdup
(
pp_status
.
input
?
pp_status
.
input
:
"<internal or cmdline>"
);
ppp
->
linenumber
=
pp_status
.
input
?
pp_status
.
line_number
:
0
;
ppp
->
next
=
pp_def_state
->
defines
[
idx
];
pp_def_state
->
defines
[
idx
]
=
ppp
;
if
(
ppp
->
next
)
ppp
->
next
->
prev
=
ppp
;
list_add_head
(
&
pp_def_state
->
defines
[
idx
],
&
ppp
->
entry
);
if
(
ppp
->
subst
.
text
)
{
/* Strip trailing white space from subst text */
...
...
@@ -345,11 +323,7 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp)
ppp
->
subst
.
mtext
=
exp
;
ppp
->
filename
=
pp_xstrdup
(
pp_status
.
input
?
pp_status
.
input
:
"<internal or cmdline>"
);
ppp
->
linenumber
=
pp_status
.
input
?
pp_status
.
line_number
:
0
;
ppp
->
next
=
pp_def_state
->
defines
[
idx
];
pp_def_state
->
defines
[
idx
]
=
ppp
;
if
(
ppp
->
next
)
ppp
->
next
->
prev
=
ppp
;
list_add_head
(
&
pp_def_state
->
defines
[
idx
],
&
ppp
->
entry
);
if
(
pp_status
.
debug
)
{
fprintf
(
stderr
,
"Added macro (%s, %d) <%s(%d)> to <"
,
pp_status
.
input
,
pp_status
.
line_number
,
ppp
->
ident
,
nargs
);
...
...
libs/wpp/wpp.c
View file @
506bdf42
...
...
@@ -32,18 +32,18 @@ int ppy_debug, pp_flex_debug;
struct
define
{
struct
define
*
next
;
struct
list
entry
;
char
*
name
;
char
*
value
;
};
static
struct
define
*
cmdline_defines
;
static
struct
list
cmdline_defines
=
LIST_INIT
(
cmdline_defines
)
;
static
void
add_cmdline_defines
(
void
)
{
struct
define
*
def
;
for
(
def
=
cmdline_defines
;
def
;
def
=
def
->
next
)
LIST_FOR_EACH_ENTRY
(
def
,
&
cmdline_defines
,
struct
define
,
entry
)
{
if
(
def
->
value
)
pp_add_define
(
def
->
name
,
def
->
value
);
}
...
...
@@ -53,7 +53,7 @@ static void del_cmdline_defines(void)
{
struct
define
*
def
;
for
(
def
=
cmdline_defines
;
def
;
def
=
def
->
next
)
LIST_FOR_EACH_ENTRY
(
def
,
&
cmdline_defines
,
struct
define
,
entry
)
{
if
(
def
->
value
)
pp_del_define
(
def
->
name
);
}
...
...
@@ -94,7 +94,7 @@ void wpp_add_define( const char *name, const char *value )
if
(
!
value
)
value
=
""
;
for
(
def
=
cmdline_defines
;
def
;
def
=
def
->
next
)
LIST_FOR_EACH_ENTRY
(
def
,
&
cmdline_defines
,
struct
define
,
entry
)
{
if
(
!
strcmp
(
def
->
name
,
name
))
{
...
...
@@ -105,10 +105,9 @@ void wpp_add_define( const char *name, const char *value )
}
def
=
pp_xmalloc
(
sizeof
(
*
def
)
);
def
->
next
=
cmdline_defines
;
def
->
name
=
pp_xstrdup
(
name
);
def
->
value
=
pp_xstrdup
(
value
);
cmdline_defines
=
def
;
list_add_head
(
&
cmdline_defines
,
&
def
->
entry
)
;
}
...
...
@@ -117,7 +116,7 @@ void wpp_del_define( const char *name )
{
struct
define
*
def
;
for
(
def
=
cmdline_defines
;
def
;
def
=
def
->
next
)
LIST_FOR_EACH_ENTRY
(
def
,
&
cmdline_defines
,
struct
define
,
entry
)
{
if
(
!
strcmp
(
def
->
name
,
name
))
{
...
...
libs/wpp/wpp_private.h
View file @
506bdf42
...
...
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include "wine/list.h"
struct
pp_entry
;
/* forward */
/*
...
...
@@ -30,8 +31,7 @@ struct pp_entry; /* forward */
* are protected in the #ifndef/#endif way.
*/
typedef
struct
includelogicentry
{
struct
includelogicentry
*
next
;
struct
includelogicentry
*
prev
;
struct
list
entry
;
struct
pp_entry
*
ppp
;
/* The define which protects the file */
char
*
filename
;
/* The filename of the include */
}
includelogicentry_t
;
...
...
@@ -81,8 +81,7 @@ typedef enum {
}
def_type_t
;
typedef
struct
pp_entry
{
struct
pp_entry
*
next
;
struct
pp_entry
*
prev
;
struct
list
entry
;
def_type_t
type
;
/* Define or macro */
char
*
ident
;
/* The key */
marg_t
**
margs
;
/* Macro arguments array or NULL if none */
...
...
@@ -217,7 +216,7 @@ struct pp_status
extern
struct
pp_status
pp_status
;
extern
include_state_t
pp_incl_state
;
extern
includelogicentry_t
*
pp_includelogiclist
;
extern
struct
list
pp_includelogiclist
;
/*
* From ppl.l
...
...
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