[PATCH v3 03/18] gweb: Add 'G_WEB_ERROR' and 'g_web_error_quark'.

Grant Erickson <[email protected]> Thu, 20 Mar 2025 16:38:54 -0700
Newsgroups dev.linux.lists.connman
Message-ID <2ebf4d6f8bb66a8fcc1f630e1b09ad6f8d5414de.1742513884.git.gerickson@nuovations.com>
These allow allocating, instantiating, and setting GWeb-specific GLib
GError structures.
---
 gweb/gweb.c | 8 ++++++++
 gweb/gweb.h | 4 ++++
 2 files changed, 12 insertions(+)

diff --git a/gweb/gweb.c b/gweb/gweb.c
index d79d2d0808cd..94d304bd40d6 100644
--- a/gweb/gweb.c
+++ b/gweb/gweb.c
@@ -157,6 +157,14 @@ static void _debug(GWeb *web, const char *file, const char *caller,
 	va_end(ap);
 }
 
+/**
+ *  Return the GWeb error quark.
+ *
+ *  @returns
+ *    The GWeb error GQuark.
+ */
+G_DEFINE_QUARK(g-web-error-quark, g_web_error)
+
 static inline void call_result_func(struct web_session *session, guint16 status)
 {
 
diff --git a/gweb/gweb.h b/gweb/gweb.h
index 90cccadbe883..6768601d6c69 100644
--- a/gweb/gweb.h
+++ b/gweb/gweb.h
@@ -119,6 +119,8 @@ typedef bool (*GWebInputFunc)(const guint8 **data, gsize *length,
 
 typedef void (*GWebDebugFunc)(const char *str, gpointer user_data);
 
+#define G_WEB_ERROR g_web_error_quark()
+
 GWeb *g_web_new(int index);
 
 GWeb *g_web_ref(GWeb *web);
@@ -183,6 +185,8 @@ void g_web_parser_feed_data(GWebParser *parser,
 				const guint8 *data, gsize length);
 void g_web_parser_end_data(GWebParser *parser);
 
+GQuark g_web_error_quark(void);
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.45.0