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
e236fe05
Unverified
Commit
e236fe05
authored
Feb 17, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
memory_utils: introduce __do_close_prot_errno
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
4101805b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
memory_utils.h
src/lxc/memory_utils.h
+11
-0
No files found.
src/lxc/memory_utils.h
View file @
e236fe05
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/types.h>
#include <unistd.h>
static
inline
void
__auto_free__
(
void
*
p
)
static
inline
void
__auto_free__
(
void
*
p
)
{
{
...
@@ -44,6 +45,16 @@ static inline void __auto_closedir__(DIR **d)
...
@@ -44,6 +45,16 @@ static inline void __auto_closedir__(DIR **d)
closedir
(
*
d
);
closedir
(
*
d
);
}
}
static
inline
void
__auto_close__
(
int
*
fd
)
{
if
(
*
fd
>=
0
)
{
int
e
=
errno
;
close
(
*
fd
);
errno
=
e
;
}
}
#define __do_close_prot_errno __attribute__((__cleanup__(__auto_close__)))
#define __do_free __attribute__((__cleanup__(__auto_free__)))
#define __do_free __attribute__((__cleanup__(__auto_free__)))
#define __do_fclose __attribute__((__cleanup__(__auto_fclose__)))
#define __do_fclose __attribute__((__cleanup__(__auto_fclose__)))
#define __do_closedir __attribute__((__cleanup__(__auto_closedir__)))
#define __do_closedir __attribute__((__cleanup__(__auto_closedir__)))
...
...
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