00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00042 #ifndef _glib_missing_h_
00043 #define _glib_missing_h_
00044
00045 #include <sys/types.h>
00046 #include <glib.h>
00047
00048 #ifdef USE_GLIB1
00049 typedef gboolean (*GEqualFunc)(gconstpointer a, gconstpointer b);
00050 #endif
00051
00052
00053
00054
00055
00056 GSList *gm_slist_insert_after(GSList *list, GSList *lnk, gpointer data);
00057
00058 GList *gm_list_insert_after(GList *list, GList *lnk, gpointer data);
00059
00060 #ifdef USE_GLIB1
00061 GList *g_list_delete_link(GList *l, GList *lnk);
00062 GString *g_string_append_len(GString *gs, const gchar *val, gssize len);
00063 #endif
00064
00065 size_t gm_vsnprintf(gchar *str, size_t n, gchar const *fmt, va_list args);
00066 size_t gm_snprintf(gchar *str, size_t n,
00067 gchar const *fmt, ...) G_GNUC_PRINTF (3, 4);
00068
00069 void gm_savemain(gint argc, gchar **argv, gchar **env);
00070 void gm_setproctitle(gchar *title);
00071 gchar *gm_sanitize_filename(const gchar *filename,
00072 gboolean no_spaces, gboolean no_evil);
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 #define G_LIST_FOREACH(list, func, user_data) \
00085 do { \
00086 GList *l_ = (list); \
00087 gpointer user_data_ = (user_data); \
00088 while (NULL != l_) { \
00089 func(l_->data, user_data_); \
00090 l_ = g_list_next(l_); \
00091 } \
00092 } while(0)
00093
00094 #define G_LIST_FOREACH_SWAPPED(list, func, user_data) \
00095 do { \
00096 GList *l_ = (list); \
00097 gpointer user_data_ = (user_data); \
00098 while (NULL != l_) { \
00099 func(user_data_, l_->data); \
00100 l_ = g_list_next(l_); \
00101 } \
00102 } while(0)
00103
00104
00105 #define G_SLIST_FOREACH(slist, func, user_data) \
00106 do { \
00107 GSList *sl_ = (slist); \
00108 gpointer user_data_ = (user_data); \
00109 while (NULL != sl_) { \
00110 func(sl_->data, user_data_); \
00111 sl_ = g_slist_next(sl_); \
00112 } \
00113 } while(0)
00114
00115
00116 #define G_SLIST_FOREACH_SWAPPED(slist, func, user_data) \
00117 do { \
00118 GSList *sl_ = (slist); \
00119 gpointer user_data_ = (user_data); \
00120 while (NULL != sl_) { \
00121 func(user_data_, sl_->data); \
00122 sl_ = g_slist_next(sl_); \
00123 } \
00124 } while(0)
00125
00126
00127 #endif