Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
VTK
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sean McBride
VTK
Commits
275e54f9
Commit
275e54f9
authored
1 year ago
by
David Gobbi
Committed by
Ben Boeckel
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Write unique paths in vtkParse dependency tracking
parent
a61047aa
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Wrapping/Tools/vtkParseDependencyTracking.c
+22
-1
22 additions, 1 deletion
Wrapping/Tools/vtkParseDependencyTracking.c
with
22 additions
and
1 deletion
Wrapping/Tools/vtkParseDependencyTracking.c
+
22
−
1
View file @
275e54f9
...
...
@@ -42,6 +42,7 @@ void vtkParse_AddFileDependency(const char* dep)
return
;
}
// in C++, an unordered set could be used
vtkParse_AddStringToArray
(
&
DepTracker
.
Dependencies
,
&
DepTracker
.
NumberOfDependencies
,
vtkParse_CacheString
(
&
DepTracker
.
Strings
,
dep
,
strlen
(
dep
)));
}
...
...
@@ -76,9 +77,17 @@ static void write_line(FILE* fout, const char* target, const char* dep)
fputc
(
'\n'
,
fout
);
}
// helper for qsort
static
int
string_compare
(
const
void
*
a
,
const
void
*
b
)
{
return
strcmp
(
*
((
const
char
**
)
a
),
*
((
const
char
**
)
b
));
}
int
vtkParse_DependencyTrackingWrite
(
const
char
*
fname
)
{
FILE
*
fout
=
NULL
;
const
char
*
prev_dep
=
NULL
;
const
char
*
dep
;
int
i
;
if
(
!
DepTracker
.
Target
)
...
...
@@ -92,9 +101,21 @@ int vtkParse_DependencyTrackingWrite(const char* fname)
return
1
;
}
// sort the data so that we can easily identify duplicates
if
(
DepTracker
.
NumberOfDependencies
>
1
)
{
qsort
(
DepTracker
.
Dependencies
,
DepTracker
.
NumberOfDependencies
,
sizeof
(
char
*
),
string_compare
);
}
for
(
i
=
0
;
i
<
DepTracker
.
NumberOfDependencies
;
++
i
)
{
write_line
(
fout
,
DepTracker
.
Target
,
DepTracker
.
Dependencies
[
i
]);
// only write if not a duplicate of the previous value
dep
=
DepTracker
.
Dependencies
[
i
];
if
(
prev_dep
==
NULL
||
strcmp
(
dep
,
prev_dep
)
!=
0
)
{
write_line
(
fout
,
DepTracker
.
Target
,
dep
);
prev_dep
=
dep
;
}
}
if
(
DepTracker
.
NumberOfDependencies
==
0
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment