1 
2 
3 /* TODO: these need to actually pool at some point ! */
4 #define GSK_DECLARE_POOL_ALLOCATORS(Type, type, pool_count)	\
5 static inline Type *						\
6 type ## _alloc ()						\
7 {								\
8   return g_new (Type, 1);					\
9 }								\
10 								\
11 static inline void						\
12 type ## _free (Type *p)						\
13 {								\
14   g_free (p);							\
15 }
16 
17 #define GSK_STRUCT_MEMBER_SIZE(type, member)    (sizeof(((type *)0)->member))
18 #define GSK_STRUCT_MEMBER_END_OFFSET(struct, member)			\
19   (GSK_STRUCT_MEMBER_SIZE (struct, member) + G_STRUCT_OFFSET (struct, member))
20 #define GSK_STRUCT_IS_LAST_MEMBER(struct, member)			\
21    (GSK_STRUCT_MEMBER_END_OFFSET(struct, member) == sizeof(struct))
22 
23 /* TODO: figure out what we're *supposed to do... */
24 #ifndef _
25 #define _(s) s
26 #endif
27 
28 
29 #define GSK_SKIP_CHAR_TYPE(ptr, condition)			\
30        G_STMT_START{						\
31 	 while (*(ptr) && condition (* (ptr)))			\
32 	   (ptr)++;						\
33        }G_STMT_END
34 
35 #ifdef G_HAVE_ISO_VARARGS
36 #define GSK_DO_NOTHING(...)
37 #elif defined(G_HAVE_GNUC_VARARGS)
38 #define GSK_DO_NOTHING(whatever...)
39 #else
GSK_DO_NOTHING(void * arg0,...)40 static inline void GSK_DO_NOTHING(void *arg0, ...) { }
41 #endif
42 
43 /* not utf8 friendly... */
44 #define GSK_SKIP_WHITESPACE(char_ptr)		GSK_SKIP_CHAR_TYPE(char_ptr, isspace)
45 #define GSK_SKIP_NONWHITESPACE(char_ptr)	GSK_SKIP_CHAR_TYPE(char_ptr, !isspace)
46 
47