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
43fd82c6
Commit
43fd82c6
authored
Apr 02, 2014
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makedep: Add helper functions to get and set variables in string arrays.
parent
83fe4ffb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
22 deletions
+41
-22
makedep.c
tools/makedep.c
+41
-22
No files found.
tools/makedep.c
View file @
43fd82c6
...
@@ -345,6 +345,42 @@ static void strarray_add_uniq( struct strarray *array, const char *str )
...
@@ -345,6 +345,42 @@ static void strarray_add_uniq( struct strarray *array, const char *str )
/*******************************************************************
/*******************************************************************
* strarray_get_value
*
* Find a value in a name/value pair string array.
*/
static
char
*
strarray_get_value
(
const
struct
strarray
*
array
,
const
char
*
name
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
array
->
count
;
i
+=
2
)
if
(
!
strcmp
(
array
->
str
[
i
],
name
))
return
xstrdup
(
array
->
str
[
i
+
1
]
);
return
NULL
;
}
/*******************************************************************
* strarray_set_value
*
* Define a value in a name/value pair string array.
*/
static
void
strarray_set_value
(
struct
strarray
*
array
,
const
char
*
name
,
const
char
*
value
)
{
unsigned
int
i
;
/* redefining a variable replaces the previous value */
for
(
i
=
0
;
i
<
array
->
count
;
i
+=
2
)
{
if
(
strcmp
(
array
->
str
[
i
],
name
))
continue
;
array
->
str
[
i
+
1
]
=
value
;
return
;
}
strarray_add
(
array
,
name
);
strarray_add
(
array
,
value
);
}
/*******************************************************************
* output_filename
* output_filename
*/
*/
static
void
output_filename
(
const
char
*
name
)
static
void
output_filename
(
const
char
*
name
)
...
@@ -1226,19 +1262,11 @@ static struct incl_file *add_src_file( const char *name )
...
@@ -1226,19 +1262,11 @@ static struct incl_file *add_src_file( const char *name )
*/
*/
static
char
*
get_make_variable
(
const
char
*
name
)
static
char
*
get_make_variable
(
const
char
*
name
)
{
{
unsigned
int
i
;
char
*
ret
;
for
(
i
=
0
;
i
<
cmdline_vars
.
count
;
i
+=
2
)
if
(
!
strcmp
(
cmdline_vars
.
str
[
i
],
name
))
return
xstrdup
(
cmdline_vars
.
str
[
i
+
1
]
);
for
(
i
=
0
;
i
<
make_vars
.
count
;
i
+=
2
)
if
(
!
strcmp
(
make_vars
.
str
[
i
],
name
))
return
xstrdup
(
make_vars
.
str
[
i
+
1
]
);
for
(
i
=
0
;
i
<
top_make_vars
.
count
;
i
+=
2
)
if
((
ret
=
strarray_get_value
(
&
cmdline_vars
,
name
)))
return
ret
;
if
(
!
strcmp
(
top_make_vars
.
str
[
i
],
name
))
if
((
ret
=
strarray_get_value
(
&
make_vars
,
name
)))
return
ret
;
return
xstrdup
(
top_make_vars
.
str
[
i
+
1
]
)
;
if
((
ret
=
strarray_get_value
(
&
top_make_vars
,
name
)))
return
ret
;
return
NULL
;
return
NULL
;
}
}
...
@@ -1312,7 +1340,6 @@ static struct strarray get_expanded_make_var_array( const char *name )
...
@@ -1312,7 +1340,6 @@ static struct strarray get_expanded_make_var_array( const char *name )
*/
*/
static
int
set_make_variable
(
struct
strarray
*
array
,
const
char
*
assignment
)
static
int
set_make_variable
(
struct
strarray
*
array
,
const
char
*
assignment
)
{
{
unsigned
int
i
;
char
*
p
,
*
name
;
char
*
p
,
*
name
;
p
=
name
=
xstrdup
(
assignment
);
p
=
name
=
xstrdup
(
assignment
);
...
@@ -1327,15 +1354,7 @@ static int set_make_variable( struct strarray *array, const char *assignment )
...
@@ -1327,15 +1354,7 @@ static int set_make_variable( struct strarray *array, const char *assignment )
*
p
++
=
0
;
*
p
++
=
0
;
while
(
isspace
(
*
p
))
p
++
;
while
(
isspace
(
*
p
))
p
++
;
/* redefining a variable replaces the previous value */
strarray_set_value
(
array
,
name
,
p
);
for
(
i
=
0
;
i
<
array
->
count
;
i
+=
2
)
{
if
(
strcmp
(
array
->
str
[
i
],
name
))
continue
;
array
->
str
[
i
+
1
]
=
p
;
return
1
;
}
strarray_add
(
array
,
name
);
strarray_add
(
array
,
p
);
return
1
;
return
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