Skip to content

Commit

Permalink
lxc: add cleanup helpers
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 15, 2020
1 parent 3990a38 commit bffb57f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lxc/lxc.h
Expand Up @@ -13,6 +13,7 @@ extern "C" {
#include <sys/types.h>

#include "compiler.h"
#include "memory_utils.h"
#include "state.h"

struct lxc_msg;
Expand Down Expand Up @@ -94,6 +95,13 @@ extern int lxc_container_get(struct lxc_container *c);
* If it is the last reference, free the lxccontainer and return 1.
*/
extern int lxc_container_put(struct lxc_container *c);
static inline void put_lxc_container(struct lxc_container *c)
{
if (c)
lxc_container_put(c);
}
define_cleanup_function(struct lxc_container *, put_lxc_container);
#define __put_lxc_container call_cleaner(put_lxc_container)

/*
* Get a list of valid wait states.
Expand Down

0 comments on commit bffb57f

Please sign in to comment.