Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
6b694061
Commit
6b694061
authored
Nov 08, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
talloc: define TALLOC_CTX
I'm not a fan of the SHOUTING, but it's upstream.
parent
c2c5cb9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
ccan/talloc/talloc.h
ccan/talloc/talloc.h
+23
-0
No files found.
ccan/talloc/talloc.h
View file @
6b694061
...
...
@@ -78,6 +78,29 @@
*/
#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
/**
* TALLOC_CTX - indicate that a pointer is used as a talloc parent.
*
* As talloc is a hierarchial memory allocator, every talloc chunk is a
* potential parent to other talloc chunks. So defining a separate type for a
* talloc chunk is not strictly necessary. TALLOC_CTX is defined nevertheless,
* as it provides an indicator for function arguments.
*
* Example:
* struct foo {
* int val;
* };
*
* static struct foo *foo_new(TALLOC_CTX *mem_ctx)
* {
* struct foo *foo = talloc(mem_ctx, struct foo);
* if (foo)
* foo->val = 0;
* return foo;
* }
*/
typedef
void
TALLOC_CTX
;
/**
* talloc_set - allocate dynamic memory for a type, into a pointer
* @ptr: pointer to the pointer to assign.
...
...
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