ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/vector.h
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/vector.h (file contents):
Revision 1.1 by ats, Sun Apr 4 21:17:58 2004 UTC vs.
Revision 1.2 by ats, Sun Apr 4 21:33:08 2004 UTC

# Line 12 | Line 12 | typedef struct {
12          vector_destroy_function destroy_fn;
13   } vector_header;
14  
15 < int statgrab_vector_resize(void **vector, vector_header *h, int count);
16 <
17 < /* Declare a vector. Specify the init/destroy functions as NULL if you don't
18 < * need them. The block size is how many items to allocate at once. */
19 < #define VECTOR_DECLARE(name, item_type, block_size, init_fn, destroy_fn) \
20 <        item_type * name = NULL; \
15 > #define VECTOR_HEADER(name, item_type, block_size, init_fn, destroy_fn) \
16          vector_header name##_header = { \
17                  sizeof(item_type), \
18                  0, \
# Line 27 | Line 22 | int statgrab_vector_resize(void **vector, vector_heade
22                  (vector_destroy_function) destroy_fn \
23          }
24  
25 + int statgrab_vector_resize(void **vector, vector_header *h, int count);
26 +
27 + /* Declare a vector. Specify the init/destroy functions as NULL if you don't
28 + * need them. The block size is how many items to allocate at once. */
29 + #define VECTOR_DECLARE(name, item_type, block_size, init_fn, destroy_fn) \
30 +        item_type *name = NULL; \
31 +        VECTOR_HEADER(name, item_type, block_size, init_fn, destroy_fn)
32 +
33 + /* As VECTOR_DECLARE, but for a static vector. */
34 + #define VECTOR_DECLARE_STATIC(name, item_type, block_size, init_fn, destroy_fn) \
35 +        static item_type *name = NULL; \
36 +        static VECTOR_HEADER(name, item_type, block_size, init_fn, destroy_fn)
37 +
38   /* Return the current size of a vector. */
39   #define VECTOR_SIZE(name) \
40          name##_header.used_count
# Line 40 | Line 48 | int statgrab_vector_resize(void **vector, vector_heade
48   /* Free a vector, destroying its contents. */
49   #define VECTOR_FREE(name) \
50          VECTOR_RESIZE(name, 0)
43
51  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines