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
3adbb41d
Commit
3adbb41d
authored
Oct 07, 2010
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
talloc: fix examples so they compile.
parent
0f9074d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
ccan/talloc/_info
ccan/talloc/_info
+1
-1
ccan/talloc/talloc.h
ccan/talloc/talloc.h
+10
-8
No files found.
ccan/talloc/_info
View file @
3adbb41d
...
...
@@ -49,7 +49,7 @@
* }
*
* // This function opens a writable pipe to the given command.
* struct command *open_output_cmd(const void *ctx, char *fmt, ...)
* st
atic st
ruct command *open_output_cmd(const void *ctx, char *fmt, ...)
* {
* va_list ap;
* struct command *cmd = talloc(ctx, struct command);
...
...
ccan/talloc/talloc.h
View file @
3adbb41d
...
...
@@ -90,9 +90,9 @@
* is not affected by talloc_set_destructor().
*
* Example:
* unsigned int *a;
* unsigned int *
b, *
a;
* a = talloc(NULL, unsigned int);
* talloc_set(&b, a
, unsigned int
);
* talloc_set(&b, a);
* talloc_free(a);
* *b = 1; // This will crash!
*
...
...
@@ -137,7 +137,7 @@
int
talloc_free
(
const
void
*
ptr
);
/**
* talloc_set_destructor
:
set a destructor for when this pointer is freed
* talloc_set_destructor
-
set a destructor for when this pointer is freed
* @ptr: the talloc pointer to set the destructor on
* @destructor: the function to be called
*
...
...
@@ -170,7 +170,7 @@ int talloc_free(const void *ptr);
* return 0;
* }
*
* int *open_file(const char *filename)
*
static
int *open_file(const char *filename)
* {
* int *fd = talloc(NULL, int);
* *fd = open(filename, O_RDONLY);
...
...
@@ -246,6 +246,7 @@ int talloc_free(const void *ptr);
*
* Example:
* void *mem = talloc_size(NULL, 100);
* memset(mem, 0xFF, 100);
*
* See Also:
* talloc, talloc_array, talloc_zero_size
...
...
@@ -342,13 +343,13 @@ void talloc_report_full(const void *ptr, FILE *f);
* a = talloc(NULL, unsigned int);
* b = talloc(NULL, unsigned int);
* c = talloc(a, unsigned int);
* // b also serves as a parent of c
.
* talloc_reference(b, c);
* // b also serves as a parent of c
(don't care about errors)
*
(void)
talloc_reference(b, c);
*/
#define talloc_reference(ctx, ptr) (_TALLOC_TYPEOF(ptr))_talloc_reference((ctx),(ptr))
/**
* talloc_unlink
:
remove a specific parent from a talloc pointer.
* talloc_unlink
-
remove a specific parent from a talloc pointer.
* @context: the parent to remove
* @ptr: the talloc pointer
*
...
...
@@ -363,13 +364,14 @@ void talloc_report_full(const void *ptr, FILE *f);
* Usually you can just use talloc_free() instead of talloc_unlink(), but
* sometimes it is useful to have the additional control on which parent is
* removed.
*
* Example:
* unsigned int *a, *b, *c;
* a = talloc(NULL, unsigned int);
* b = talloc(NULL, unsigned int);
* c = talloc(a, unsigned int);
* // b also serves as a parent of c.
* talloc_reference(b, c);
*
(void)
talloc_reference(b, c);
* talloc_unlink(b, c);
*/
int
talloc_unlink
(
const
void
*
context
,
void
*
ptr
);
...
...
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