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
81cba860
Unverified
Commit
81cba860
authored
Nov 30, 2019
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macro: remove unused macros
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0440c0e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
72 deletions
+9
-72
cgroup2_devices.c
src/lxc/cgroups/cgroup2_devices.c
+1
-1
macro.h
src/lxc/macro.h
+8
-71
No files found.
src/lxc/cgroups/cgroup2_devices.c
View file @
81cba860
...
@@ -359,7 +359,7 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
...
@@ -359,7 +359,7 @@ int bpf_program_cgroup_attach(struct bpf_program *prog, int type,
if
(
ret
<
0
)
if
(
ret
<
0
)
return
error_log_errno
(
errno
,
"Failed to attach bpf program"
);
return
error_log_errno
(
errno
,
"Failed to attach bpf program"
);
free_
and_replace
(
prog
->
attached_path
,
copy
);
free_
replace_move_ptr
(
prog
->
attached_path
,
copy
);
prog
->
attached_type
=
type
;
prog
->
attached_type
=
type
;
prog
->
attached_flags
=
flags
;
prog
->
attached_flags
=
flags
;
...
...
src/lxc/macro.h
View file @
81cba860
...
@@ -420,6 +420,14 @@ enum {
...
@@ -420,6 +420,14 @@ enum {
-1; \
-1; \
})
})
#define free_replace_move_ptr(a, b) \
({ \
free(a); \
(a) = (b); \
(b) = NULL; \
0; \
})
/* Container's specific file/directory names */
/* Container's specific file/directory names */
#define LXC_CONFIG_FNAME "config"
#define LXC_CONFIG_FNAME "config"
#define LXC_PARTIAL_FNAME "partial"
#define LXC_PARTIAL_FNAME "partial"
...
@@ -427,77 +435,6 @@ enum {
...
@@ -427,77 +435,6 @@ enum {
#define LXC_TIMESTAMP_FNAME "ts"
#define LXC_TIMESTAMP_FNAME "ts"
#define LXC_COMMENT_FNAME "comment"
#define LXC_COMMENT_FNAME "comment"
/* Taken from systemd. */
#define free_and_replace(a, b) \
({ \
free(a); \
(a) = (b); \
(b) = NULL; \
0; \
})
#define XCONCATENATE(x, y) x##y
#define CONCATENATE(x, y) XCONCATENATE(x, y)
#define UNIQ_T(x, uniq) CONCATENATE(__unique_prefix_, CONCATENATE(x, uniq))
#define UNIQ __COUNTER__
#undef MIN
#define MIN(a, b) __MIN(UNIQ, (a), UNIQ, (b))
#define __MIN(aq, a, bq, b) \
({ \
const typeof(a) UNIQ_T(A, aq) = (a); \
const typeof(b) UNIQ_T(B, bq) = (b); \
UNIQ_T(A, aq) < UNIQ_T(B, bq) ? UNIQ_T(A, aq) : UNIQ_T(B, bq); \
})
/* Taken from the kernel. */
/*
* min()/max()/clamp() macros must accomplish three things:
*
* - avoid multiple evaluations of the arguments (so side-effects like
* "x++" happen only once) when non-constant.
* - perform strict type-checking (to generate warnings instead of
* nasty runtime surprises). See the "unnecessary" pointer comparison
* in __typecheck().
* - retain result as a constant expressions when called with only
* constant expressions (to avoid tripping VLA warnings in stack
* allocation usage).
*/
#define __typecheck(x, y) (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
/*
* This returns a constant expression while determining if an argument is
* a constant expression, most importantly without evaluating the argument.
* Glory to Martin Uecker <Martin.Uecker@med.uni-goettingen.de>
*/
#define __is_constexpr(x) \
(sizeof(int) == sizeof(*(8 ? ((void *)((long)(x)*0l)) : (int *)8)))
#define __no_side_effects(x, y) (__is_constexpr(x) && __is_constexpr(y))
#define __safe_cmp(x, y) (__typecheck(x, y) && __no_side_effects(x, y))
#define __cmp(x, y, op) ((x)op(y) ? (x) : (y))
#define __cmp_once(x, y, unique_x, unique_y, op) \
({ \
typeof(x) unique_x = (x); \
typeof(y) unique_y = (y); \
__cmp(unique_x, unique_y, op); \
})
#define __careful_cmp(x, y, op) \
__builtin_choose_expr(__safe_cmp(x, y), __cmp(x, y, op), \
__cmp_once(x, y, __UNIQUE_ID(__x), \
__UNIQUE_ID(__y), op))
/**
* min - return minimum of two values of the same or compatible types
* @x: first value
* @y: second value
*/
#define min(x, y) __careful_cmp(x, y, <)
#define ARRAY_SIZE(x) \
#define ARRAY_SIZE(x) \
(__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \
(__builtin_choose_expr(!__builtin_types_compatible_p(typeof(x), \
typeof(&*(x))), \
typeof(&*(x))), \
...
...
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