00001 #pragma once
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00029 #include <stdarg.h>
00030 #include <stdio.h>
00031 #include <string.h>
00032 #include <errno.h>
00033 #include <glib.h>
00034 #include <common/gfal_constants.h>
00035
00036
00037
00038 #ifdef __cplusplus
00039 extern "C"
00040 {
00041 #endif
00042
00043
00044 extern const char* no_err;
00045
00049 #define g_return_val_err_if_fail(exp,val,err,msg) if(!(exp)){ g_set_error(err,0,EINVAL,msg); return val; }
00050
00054 #define G_RETURN_ERR(ret, tmp_err, err) \
00055 if(tmp_err)\
00056 g_propagate_prefixed_error(err, tmp_err, "[%s]", __func__);\
00057 return ret
00058
00059
00060 void gfal_print_verbose(int verbose_lvl,const char* msg, ...);
00066 int gfal_set_verbose (int value);
00067
00068 int gfal_get_verbose();
00069
00070
00071 void gfal_release_GError(GError** err);
00072
00073 gboolean gfal_check_GError(GError** err);
00074
00075 char* gfal_str_GError(GError** err);
00076
00077 char* gfal_str_GError_r(GError** err, char* buff_err, size_t s_err);
00078
00079
00080 #if (GLIB_CHECK_VERSION(2,16,0) != TRUE) // add a advanced functions of glib for the old versions
00081
00082 #define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n"
00083
00084 void g_propagate_prefixed_error (GError **dest,
00085 GError *src,
00086 const gchar *format,
00087 ...) G_GNUC_PRINTF (3, 4);
00088
00089 void g_prefix_error(GError **err,
00090 const gchar *format,
00091 ...);
00092
00093
00094 #endif
00095
00096
00097 #if (GLIB_CHECK_VERSION(2,28,0) != TRUE)
00098 void g_list_free_full(GList *list, GDestroyNotify free_func);
00099 #endif
00100
00101 #ifdef __cplusplus
00102 }
00103 #endif