Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
bb8c2e66
You need to sign in or sign up before continuing.
Commit
bb8c2e66
authored
15 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
freedir() shouldn't need to return anything
parent
d8058362
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/util.c
+7
-16
7 additions, 16 deletions
src/util.c
src/util.h
+1
-1
1 addition, 1 deletion
src/util.h
with
8 additions
and
17 deletions
src/util.c
+
7
−
16
View file @
bb8c2e66
...
@@ -176,8 +176,8 @@ void freedir_rec(struct dir *dr) {
...
@@ -176,8 +176,8 @@ void freedir_rec(struct dir *dr) {
}
}
struct
dir
*
freedir
(
struct
dir
*
dr
)
{
void
freedir
(
struct
dir
*
dr
)
{
struct
dir
*
tmp
,
*
cur
;
struct
dir
*
tmp
;
/* update sizes of parent directories */
/* update sizes of parent directories */
tmp
=
dr
;
tmp
=
dr
;
...
@@ -187,33 +187,24 @@ struct dir *freedir(struct dir *dr) {
...
@@ -187,33 +187,24 @@ struct dir *freedir(struct dir *dr) {
tmp
->
items
-=
dr
->
items
+
1
;
tmp
->
items
-=
dr
->
items
+
1
;
}
}
/* free dr->sub recursive */
/* free dr->sub recursively */
if
(
dr
->
sub
)
freedir_rec
(
dr
->
sub
);
if
(
dr
->
sub
)
freedir_rec
(
dr
->
sub
);
/* update references */
/* update references */
cur
=
NULL
;
if
(
dr
->
parent
)
{
if
(
dr
->
parent
)
{
/* item is at the top of the dir, refer to next item */
/* item is at the top of the dir, refer to next item */
if
(
dr
->
parent
->
sub
==
dr
)
{
if
(
dr
->
parent
->
sub
==
dr
)
dr
->
parent
->
sub
=
dr
->
next
;
dr
->
parent
->
sub
=
dr
->
next
;
cur
=
dr
->
next
;
}
/* else, get the previous item and update it's "next"-reference */
/* else, get the previous item and update it's "next"-reference */
else
else
for
(
tmp
=
dr
->
parent
->
sub
;
tmp
!=
NULL
;
tmp
=
tmp
->
next
)
for
(
tmp
=
dr
->
parent
->
sub
;
tmp
!=
NULL
;
tmp
=
tmp
->
next
)
if
(
tmp
->
next
==
dr
)
{
if
(
tmp
->
next
==
dr
)
tmp
->
next
=
dr
->
next
;
tmp
->
next
=
dr
->
next
;
cur
=
tmp
;
}
/* no previous item, refer to parent dir */
if
(
cur
==
NULL
&&
dr
->
parent
->
parent
)
cur
=
dr
->
parent
;
}
}
free
(
dr
->
name
);
free
(
dr
->
name
);
free
(
dr
);
free
(
dr
);
return
cur
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/util.h
+
1
−
1
View file @
bb8c2e66
...
@@ -72,7 +72,7 @@ char *formatsize(const off_t);
...
@@ -72,7 +72,7 @@ char *formatsize(const off_t);
char
*
fullsize
(
const
off_t
);
char
*
fullsize
(
const
off_t
);
/* recursively free()s a directory tree */
/* recursively free()s a directory tree */
struct
dir
*
freedir
(
struct
dir
*
);
void
freedir
(
struct
dir
*
);
/* generates full path from a dir item */
/* generates full path from a dir item */
char
*
getpath
(
struct
dir
*
,
char
*
);
char
*
getpath
(
struct
dir
*
,
char
*
);
...
...
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