array.h revision c6eca51b54586c1f37cfe39e38c844da3f937a4d
#ifndef __ARRAY_H
#define __ARRAY_H
/* Array is a buffer accessible using fixed size elements. As long as the
compiler provides typeof() function, the array provides type safety. If
a wrong type is tried to be added to the array, or if the array's contents
are tried to be used using a wrong type, the compiler will give a warning.
Example usage:
struct foo {
ARRAY_DEFINE(bars, struct bar);
...
};
i_array_init(&foo->bars, 10);
struct bar *bar = array_idx(&foo->bars, 5);
struct baz *baz = array_idx(&foo->bars, 5); // compiler warning
If you want to pass an array as a parameter to a function, you'll need to
create a type for the array using ARRAY_DEFINE_TYPE() and use the type in
the parameter using ARRAY_TYPE().
Example:
ARRAY_DEFINE_TYPE(foo, struct foo);
void do_foo(ARRAY_TYPE(foo) *bars) {
struct foo *foo = array_idx(bars, 0);
}
*/
#include "array-decl.h"
#include "buffer.h"
#ifdef __GNUC__
# define ARRAY_TYPE_CAST_CONST(array) \
# define ARRAY_TYPE_CAST_MODIFIABLE(array) \
#else
# define ARRAY_TYPE_CAST_CONST(array)
# define ARRAY_TYPE_CAST_MODIFIABLE(array)
#endif
static inline void
{
}
static inline void
{
}
static inline void
{
}
#define array_free(array) \
static inline bool
{
}
#define array_is_created(array) \
static inline void
{
}
#define array_clear(array) \
static inline void
{
}
} STMT_END
static inline void
{
}
static inline void
{
}
} STMT_END
static inline void
{
}
static inline const void *
{
}
static inline const void *
{
}
#ifdef DISABLE_ASSERTS
#else
#endif
static inline void *
{
}
static inline void *
{
/* index doesn't exist yet, initialize with zero */
}
}
static inline void
{
/* index doesn't exist yet, initialize with zero */
}
}
} STMT_END
static inline void
{
/* index doesn't exist yet, initialize with zero */
} else {
}
}
static inline void *
{
void *data;
return data;
}
#define array_append_space(array) \
static inline void *
{
void *data;
return data;
}
static inline unsigned int
{
}
#define array_count(array) \
static inline bool
{
if (!_array_is_created(array2))
return FALSE;
}
#endif