~ubuntu-branches/debian/sid/upstart/sid

« back to all changes in this revision

Viewing changes to nih/alloc.h

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2006-12-13 17:27:37 UTC
  • mto: (16.1.6 feisty)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20061213172737-xtzw97b0cl4q7oc5
Tags: upstream-0.3.1
ImportĀ upstreamĀ versionĀ 0.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 *
31
31
 * An allocator is a function that can be used to both allocate memory
32
32
 * and return it to the system (or cache it, etc.)  The behaviour should
33
 
 * be the same of that as the standard #realloc function.
 
33
 * be the same of that as the standard realloc() function.
34
34
 **/
35
35
typedef void *(*NihAllocator) (void *, size_t);
36
36
 
56
56
 * Allocates a block of memory large enough to store a @type object and
57
57
 * returns a pointer to it.
58
58
 *
59
 
 * If @parent is not %NULL, it should be a pointer to another allocated
 
59
 * If @parent is not NULL, it should be a pointer to another allocated
60
60
 * block which will be used as the parent for this block.  When @parent
61
61
 * is freed, the returned block will be freed too.  If you have clean-up
62
62
 * that would need to be run, you can assign a destructor function using
63
 
 * the #nih_alloc_set_destructor function.
 
63
 * the nih_alloc_set_destructor() function.
64
64
 *
65
65
 * Returns: requested memory block.
66
66
 **/
83
83
 
84
84
int    nih_free                 (void *ptr);
85
85
 
 
86
void   nih_alloc_reparent       (void *ptr, const void *parent);
 
87
 
86
88
void   nih_alloc_set_destructor (void *ptr, NihDestructor destructor);
87
89
 
88
90
size_t nih_alloc_size           (const void *ptr);