Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
1e10f10b
Commit
1e10f10b
authored
Jul 10, 2023
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miniobj: Allocate objects with a flexible array
parent
c8bb4150
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
miniobj.h
include/miniobj.h
+11
-0
No files found.
include/miniobj.h
View file @
1e10f10b
...
@@ -30,6 +30,17 @@
...
@@ -30,6 +30,17 @@
(to)->magic = (type_magic); \
(to)->magic = (type_magic); \
} while (0)
} while (0)
#define ALLOC_FLEX_OBJ(to, fld, len, type_magic) \
do { \
v_static_assert( \
sizeof *(to) == offsetof(typeof(*(to)), fld), \
"the last field must be a flexible array"); \
(to) = calloc(1, \
sizeof *(to) + ((len) * sizeof *((to)->fld))); \
if ((to) != NULL) \
(to)->magic = (type_magic); \
} while (0)
#define FREE_OBJ(to) \
#define FREE_OBJ(to) \
do { \
do { \
ZERO_OBJ(&(to)->magic, sizeof (to)->magic); \
ZERO_OBJ(&(to)->magic, sizeof (to)->magic); \
...
...
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