Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
systemd
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
steam
systemd
Commits
e3ded78b
Commit
e3ded78b
authored
Jan 28, 2013
by
Zbigniew Jędrzejewski-Szmek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shared: introduce _cleanup_set_free_free_
parent
01233fc7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
0 deletions
+10
-0
src/shared/macro.h
src/shared/macro.h
+1
-0
src/shared/set.c
src/shared/set.c
+8
-0
src/shared/set.h
src/shared/set.h
+1
-0
No files found.
src/shared/macro.h
View file @
e3ded78b
...
...
@@ -201,6 +201,7 @@ static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
#define _cleanup_closedir_ __attribute__((cleanup(closedirp)))
#define _cleanup_umask_ __attribute__((cleanup(umaskp)))
#define _cleanup_set_free_ __attribute__((cleanup(set_freep)))
#define _cleanup_set_free_free_ __attribute__((cleanup(set_free_freep)))
#define _cleanup_strv_free_ __attribute__((cleanup(strv_freep)))
#define VA_FORMAT_ADVANCE(format, ap) \
...
...
src/shared/set.c
View file @
e3ded78b
...
...
@@ -49,6 +49,14 @@ void set_free_free(Set *s) {
hashmap_free_free
(
MAKE_HASHMAP
(
s
));
}
void
set_free_freep
(
Set
**
s
)
{
if
(
!*
s
)
return
;
set_free_free
(
*
s
);
*
s
=
NULL
;
}
int
set_ensure_allocated
(
Set
**
s
,
hash_func_t
hash_func
,
compare_func_t
compare_func
)
{
return
hashmap_ensure_allocated
((
Hashmap
**
)
s
,
hash_func
,
compare_func
);
}
...
...
src/shared/set.h
View file @
e3ded78b
...
...
@@ -35,6 +35,7 @@ Set *set_new(hash_func_t hash_func, compare_func_t compare_func);
void
set_free
(
Set
*
s
);
void
set_freep
(
Set
**
s
);
void
set_free_free
(
Set
*
s
);
void
set_free_freep
(
Set
**
s
);
Set
*
set_copy
(
Set
*
s
);
int
set_ensure_allocated
(
Set
**
s
,
hash_func_t
hash_func
,
compare_func_t
compare_func
);
...
...
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