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
9c3d28ce
Commit
9c3d28ce
authored
Aug 21, 2023
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miniobj: Add ALLOC_OBJ_EXTRA() requested by PHK
And use it to implement ALLOC_FLEX_OBJ().
parent
9cc2fd87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
miniobj.h
include/miniobj.h
+5
-3
No files found.
include/miniobj.h
View file @
9c3d28ce
...
...
@@ -30,14 +30,16 @@
(to)->magic = (type_magic); \
} while (0)
#define ALLOC_
FLEX_OBJ(to, fld, len
, type_magic) \
#define ALLOC_
OBJ_EXTRA(to, extra_size
, type_magic) \
do { \
(to) = calloc(1, sizeof(*(to)) + \
((len) * sizeof *((to)->fld))); \
(to) = calloc(1, sizeof(*(to)) + (extra_size)); \
if ((to) != NULL) \
(to)->magic = (type_magic); \
} while (0)
#define ALLOC_FLEX_OBJ(to, fld, len, type_magic) \
ALLOC_OBJ_EXTRA(to, (len) * sizeof *((to)->fld), (type_magic))
#define FREE_OBJ(to) \
do { \
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