Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
884b37d0
Unverified
Commit
884b37d0
authored
Feb 08, 2019
by
Serge Hallyn
Committed by
GitHub
Feb 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2827 from brauner/2019-02-07/auto_cleanup
cgroups: partially switch to cleanup macros
parents
42bd57bd
d97919ab
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
cgfsng.c
src/lxc/cgroups/cgfsng.c
+0
-0
memory_utils.h
src/lxc/memory_utils.h
+18
-0
No files found.
src/lxc/cgroups/cgfsng.c
View file @
884b37d0
This diff is collapsed.
Click to expand it.
src/lxc/memory_utils.h
View file @
884b37d0
...
...
@@ -20,13 +20,31 @@
#ifndef __LXC_MEMORY_UTILS_H
#define __LXC_MEMORY_UTILS_H
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
static
inline
void
__auto_free__
(
void
*
p
)
{
free
(
*
(
void
**
)
p
);
}
static
inline
void
__auto_fclose__
(
FILE
**
f
)
{
if
(
*
f
)
fclose
(
*
f
);
}
static
inline
void
__auto_closedir__
(
DIR
**
d
)
{
if
(
*
d
)
closedir
(
*
d
);
}
#define __do_free __attribute__((__cleanup__(__auto_free__)))
#define __do_fclose __attribute__((__cleanup__(__auto_fclose__)))
#define __do_closedir __attribute__((__cleanup__(__auto_closedir__)))
#endif
/* __LXC_MEMORY_UTILS_H */
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