glib' GError.



hi,


I was trying to use GError for Mango and came accross some 
things which I would like to be able to change before GLib is 
stabilized:

1) stupid API renamings:

g_set_error -> g_error_set
g_propagate_error -> g_error_propagate
g_clear_error -> g_error_release or g_error_clear

2) less stupid concerns: 

struct _GError
{
  GQuark       domain;
  gint         code;
-  gchar       *message;
+  gpointer    data;
};

This would make GError much more generic and allow me to reuse it...
It would also mean changing the folowing: 

GError*  g_error_new           (GQuark         domain,
                                gint           code,
-                                const gchar   *format,
+                               const gpointer data,
                                ...);

+ GError*  g_error_message_new   (GQuark         domain,
+                                gint           code,
+                                const gchar   *format,
+                                ...) G_GNUC_PRINTF (3, 4);


- GError*  g_error_new_literal   (GQuark         domain,
+ GError*  g_error_message_new_literal   (GQuark         domain,
                                        gint           code,
                                        const gchar   *message);

void     g_error_free          (GError        *error);
GError*  g_error_copy          (const GError  *error);

gboolean g_error_matches       (const GError  *error,
                                GQuark         domain,
                                gint           code);


Of course, I would volunteer to make a big patch to all GLib/GTK+ which uses it.
As an alternative, I could go for the folowing less intrusive change:

struct _GError
{
  GQuark       domain;
  gint         code;
-  gchar       *message;
+  gpointer    data;
};

+GError*  g_error_data_new       (GQuark         domain,
+                                 gint           code,
+                                const gpointer data);


Any comments ?

regards,
Mathieu

-- 
Mathieu Lacage <mathieu eazel com>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]