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
ec7664d4
Commit
ec7664d4
authored
Nov 11, 2015
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
makedep: Add a helper function to open a file in the parent's source directory.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
391364e0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
10 deletions
+37
-10
makedep.c
tools/makedep.c
+37
-10
No files found.
tools/makedep.c
View file @
ec7664d4
...
...
@@ -489,6 +489,25 @@ static char *replace_extension( const char *name, const char *old_ext, const cha
/*******************************************************************
* replace_filename
*/
static
char
*
replace_filename
(
const
char
*
path
,
const
char
*
name
)
{
const
char
*
p
;
char
*
ret
;
size_t
len
;
if
(
!
path
)
return
xstrdup
(
name
);
if
(
!
(
p
=
strrchr
(
path
,
'/'
)))
return
xstrdup
(
name
);
len
=
p
-
path
+
1
;
ret
=
xmalloc
(
len
+
strlen
(
name
)
+
1
);
memcpy
(
ret
,
path
,
len
);
strcpy
(
ret
+
len
,
name
);
return
ret
;
}
/*******************************************************************
* strarray_replace_extension
*/
static
struct
strarray
strarray_replace_extension
(
const
struct
strarray
*
array
,
...
...
@@ -1201,6 +1220,22 @@ static struct file *open_file( const struct makefile *make, const char *path, ch
/*******************************************************************
* open_file_same_dir
*
* Open a file in the same directory as the parent.
*/
static
struct
file
*
open_file_same_dir
(
const
struct
incl_file
*
parent
,
const
char
*
name
,
char
**
filename
)
{
char
*
src_path
=
replace_filename
(
parent
->
file
->
name
,
name
);
struct
file
*
ret
=
load_file
(
src_path
);
if
(
ret
)
*
filename
=
replace_filename
(
parent
->
filename
,
name
);
free
(
src_path
);
return
ret
;
}
/*******************************************************************
* open_local_file
*
* Open a file in the source directory of the makefile.
...
...
@@ -1270,7 +1305,7 @@ static struct file *open_src_file( const struct makefile *make, struct incl_file
static
struct
file
*
open_include_file
(
const
struct
makefile
*
make
,
struct
incl_file
*
pFile
)
{
struct
file
*
file
=
NULL
;
char
*
filename
,
*
p
;
char
*
filename
;
unsigned
int
i
,
len
;
errno
=
ENOENT
;
...
...
@@ -1383,15 +1418,7 @@ static struct file *open_include_file( const struct makefile *make, struct incl_
if
(
pFile
->
type
==
INCL_SYSTEM
)
return
NULL
;
/* ignore system files we cannot find */
/* try in src file directory */
if
((
p
=
strrchr
(
pFile
->
included_by
->
filename
,
'/'
)))
{
size_t
l
=
p
-
pFile
->
included_by
->
filename
+
1
;
filename
=
xmalloc
(
l
+
strlen
(
pFile
->
name
)
+
1
);
memcpy
(
filename
,
pFile
->
included_by
->
filename
,
l
);
strcpy
(
filename
+
l
,
pFile
->
name
);
if
((
file
=
open_file
(
make
,
filename
,
&
pFile
->
filename
)))
return
file
;
free
(
filename
);
}
if
((
file
=
open_file_same_dir
(
pFile
->
included_by
,
pFile
->
name
,
&
pFile
->
filename
)))
return
file
;
fprintf
(
stderr
,
"%s:%d: error: "
,
pFile
->
included_by
->
file
->
name
,
pFile
->
included_line
);
perror
(
pFile
->
name
);
...
...
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