Helpful MacrosHelpful Macros — Various macros to eliminate tedious typing,
beyond those provided by glib. | |
Details
GSK_DECLARE_POOL_ALLOCATORS()
#define GSK_DECLARE_POOL_ALLOCATORS(Type, type, pool_count)
Declare static inline functions type_free and type_alloc,
(where type is the second parameter to this macro)
which use GMemChunks to implement fast allocation.
Type is the name of the name of structure to allocate;
and pool_count is the number to allocate at once.
Type : | Real type of the things to allocate.
|
type : | Lowercased type name, for mangling into the function name.
|
pool_count : | Number of things to allocate at once.
|
GSK_STRUCT_MEMBER_SIZE()
#define GSK_STRUCT_MEMBER_SIZE(type, member) (sizeof(((type *)0)->member))
Find size in bytes of a structure member.
GSK_STRUCT_MEMBER_END_OFFSET()
#define GSK_STRUCT_MEMBER_END_OFFSET(struct, member)
Find offset of a member's end in bytes.
GSK_SKIP_CHAR_TYPE()
#define GSK_SKIP_CHAR_TYPE(ptr, condition)
Skip ptr along until it fails the condition.
ptr : | pointer to a NUL-terminated string.
|
condition : | function predicate to test characters with.
|
GSK_SKIP_WHITESPACE()
#define GSK_SKIP_WHITESPACE(char_ptr) GSK_SKIP_CHAR_TYPE(char_ptr, isspace)
Skip char_ptr along until it gets to a non-whitespace character, or the end of the string.
char_ptr : | the pointer to advance.
|
GSK_SKIP_NONWHITESPACE()
#define GSK_SKIP_NONWHITESPACE(char_ptr) GSK_SKIP_CHAR_TYPE(char_ptr, !isspace)
Skip char_ptr along until it gets to a whitespace character, or the end of the string.
char_ptr : | the pointer to advance.
|