Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
503dbd59
Commit
503dbd59
authored
May 28, 2009
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store pristine contents of files: based on Joey's patch.
parent
bda94e9f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
tools/ccanlint/ccanlint.h
tools/ccanlint/ccanlint.h
+5
-0
tools/ccanlint/file_analysis.c
tools/ccanlint/file_analysis.c
+16
-8
No files found.
tools/ccanlint/ccanlint.h
View file @
503dbd59
...
@@ -88,6 +88,11 @@ struct ccan_file {
...
@@ -88,6 +88,11 @@ struct ccan_file {
char
*
name
;
char
*
name
;
/* Pristine version of the original file.
* Use get_ccan_file_lines to fill this. */
const
char
*
contents
;
size_t
contents_size
;
/* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
/* Use get_ccan_file_lines / get_ccan_line_info to fill these. */
unsigned
int
num_lines
;
unsigned
int
num_lines
;
char
**
lines
;
char
**
lines
;
...
...
tools/ccanlint/file_analysis.c
View file @
503dbd59
...
@@ -17,12 +17,9 @@
...
@@ -17,12 +17,9 @@
char
**
get_ccan_file_lines
(
struct
ccan_file
*
f
)
char
**
get_ccan_file_lines
(
struct
ccan_file
*
f
)
{
{
if
(
!
f
->
lines
)
{
if
(
!
f
->
lines
)
char
*
buffer
=
grab_file
(
f
,
f
->
name
,
NULL
);
f
->
lines
=
strsplit
(
f
,
f
->
contents
,
"
\n
"
,
&
f
->
num_lines
);
if
(
!
buffer
)
err
(
1
,
"Getting file %s"
,
f
->
name
);
f
->
lines
=
strsplit
(
f
,
buffer
,
"
\n
"
,
&
f
->
num_lines
);
}
return
f
->
lines
;
return
f
->
lines
;
}
}
...
@@ -76,13 +73,24 @@ static void add_files(struct manifest *m, const char *dir)
...
@@ -76,13 +73,24 @@ static void add_files(struct manifest *m, const char *dir)
if
(
streq
(
f
->
name
,
"_info.c"
))
{
if
(
streq
(
f
->
name
,
"_info.c"
))
{
m
->
info_file
=
f
;
m
->
info_file
=
f
;
f
->
contents
=
grab_file
(
f
,
f
->
name
,
&
f
->
contents_size
);
if
(
!
f
->
contents
)
err
(
1
,
"Reading file %s"
,
f
->
name
);
continue
;
continue
;
}
}
is_c_src
=
strends
(
f
->
name
,
".c"
);
is_c_src
=
strends
(
f
->
name
,
".c"
);
if
(
!
is_c_src
&&
!
strends
(
f
->
name
,
".h"
))
if
(
!
is_c_src
&&
!
strends
(
f
->
name
,
".h"
))
{
/* We don't pull in contents of non-source files */
dest
=
&
m
->
other_files
;
dest
=
&
m
->
other_files
;
else
if
(
!
strchr
(
f
->
name
,
'/'
))
{
continue
;
}
f
->
contents
=
grab_file
(
f
,
f
->
name
,
&
f
->
contents_size
);
if
(
!
f
->
contents
)
err
(
1
,
"Reading file %s"
,
f
->
name
);
if
(
!
strchr
(
f
->
name
,
'/'
))
{
if
(
is_c_src
)
if
(
is_c_src
)
dest
=
&
m
->
c_files
;
dest
=
&
m
->
c_files
;
else
else
...
...
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