X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fheap.h;h=abb6c83f36af0558d084c5736da5abd995e3af79;hb=refs%2Fchanges%2F26%2F149726%2F1;hp=744e6c0905514764f438e3322634502e7e278374;hpb=65646cd6fa8cbf60bfb58ff2d161f4d88aa81058;p=platform%2Fcore%2Fsystem%2Ftizen-platform-config.git diff --git a/src/heap.h b/src/heap.h index 744e6c0..abb6c83 100644 --- a/src/heap.h +++ b/src/heap.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2013-2014 Intel Corporation. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -16,32 +16,32 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: - * José Bollo - * Stéphane Desneux - * Jean-Benoit Martin + * José Bollo + * Stéphane Desneux + * Jean-Benoit Martin * */ #ifndef HEAP_H #define HEAP_H /* null offset value */ -#define HNULL ((size_t)-1) +#define HNULL ((size_t)-1) /* structure defining the heap */ struct heap { - char *data; /* pointer to data of the heap */ - size_t size; /* count of used byte of the heap */ - size_t capacity; /* count of byte of the heap */ + char *data; /* pointer to data of the heap */ + size_t size; /* count of used byte of the heap */ + size_t capacity; /* count of byte of the heap */ }; /* Return the address of the 'heap' memory of 'offset'. The returned pointer is only valid until - a call to 'heap_destroy', 'heap_resize', 'heap_alloc' + a call to 'heap_destroy', 'heap_resize', 'heap_alloc' */ -inline static void *heap_address( struct heap *heap, size_t offset) +static inline void *heap_address(struct heap *heap, size_t offset) { - return heap->data + offset; + return heap->data + offset; } @@ -50,50 +50,50 @@ inline static void *heap_address( struct heap *heap, size_t offset) The allocated size will be zero. Returns 0 if success, -1 if error occured (see then errno) */ -int heap_create( struct heap *heap, size_t capacity); +int heap_create(struct heap *heap, size_t capacity); /* Resize the 'heap' to 'size'. Returns 0 if success, -1 if error occured (see then errno) */ -int heap_resize( struct heap *heap, size_t size); +int heap_resize(struct heap *heap, size_t size); /* Allocation of 'count' bytes from the 'heap'. Returns the offset (in byte) from the start of the heap. Return HNULL in case of error (see then errno). */ -size_t heap_alloc( struct heap *heap, size_t count); +size_t heap_alloc(struct heap *heap, size_t count); /* Copy the 'string' of 'length' in the 'heap', appending a terminating null. Return the offset or HNULL if error. */ -size_t heap_strndup( struct heap *heap, const char *string, size_t length); +size_t heap_strndup(struct heap *heap, const char *string, size_t length); /* Copy the 'string' in the 'heap' with the terminating null. Return the offset or HNULL if error. */ -size_t heap_strdup( struct heap *heap, const char *string); +size_t heap_strdup(struct heap *heap, const char *string); /* Destroy the 'heap'. Returns 0 if success, -1 if error occured (see then errno) */ -int heap_destroy( struct heap *heap); +int heap_destroy(struct heap *heap); /* Set the heap as read/write Returns 0 if success, -1 if error occured (see then errno) */ -int heap_read_write( struct heap *heap); +int heap_read_write(struct heap *heap); /* Set the heap as read only Returns 0 if success, -1 if error occured (see then errno) */ -int heap_read_only( struct heap *heap); +int heap_read_only(struct heap *heap); #endif