+#define G_LOG_DOMAIN ((const gchar *)"UDPGate")
+
+/**
+ * udpgate_newn:
+ * @objp: Variable with the pointer to the objects wished to be allocated.
+ * Original value is discarded.
+ * @n: Numbers of objects to be allocated. Value %0 is permitted (%NULL assignment effect).
+ *
+ * Macro to allocate @n objects of type *@objp and to assign the resulting pointer to @objp.
+ * Allocated memory may contain garbage.
+ *
+ * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp))*n.
+ * Value %NULL is returned iff @n==%0;
+ */
+#define udpgate_newn(objp,n) ((objp)=g_new(typeof(*(objp)),(n)))
+
+/**
+ * udpgate_new:
+ * @objp: Variable with the pointer to the object wished to be allocated.
+ * Original value is discarded.
+ *
+ * Macro to allocate one object of type *@objp and to assign the resulting pointer to @objp.
+ * Allocated memory may contain garbage. Equivalent to udpgate_newn(objp,1) call.
+ *
+ * @Returns: Initialized @objp value as the memory of size #sizeof(typeof(*objp)).
+ * Value %NULL is never returned.
+ */
+#define udpgate_new(objp) (udpgate_newn((objp),1))
+
+/**
+ * UDPGATE_MEMZERO:
+ * @objp: Pointer to the variable to be cleared.
+ *
+ * Clears the sizeof(*@objp) bytes of the given pointer with memset().
+ * Pass _pointer_ to the object to be cleared.
+ */
+#define UDPGATE_MEMZERO(objp) (memset((objp),0,sizeof(*(objp))))
+
+/**
+ * udpgate_printf_alloca:
+ * @format: Format string. See the sprintf() documentation.
+ * @args...: Arguments for @format. See the sprintf() documentation.
+ *
+ * Format the given format string @format as in sprintf().
+ * Output buffer is allocated automatically and it does not need to be deallocated
+ * manually as it is managed by g_alloca().
+ *
+ * @Returns: Formatted output string located in g_alloca() memory.
+ */
+#include <glib/galloca.h>
+#include <glib/gutils.h>
+#define udpgate_printf_alloca(format,args...) ({ \
+ gsize _udpgate_printf_alloca_size=udpgate_nv_printf_string_upper_bound((format) , ## args); \
+ gchar *_udpgate_printf_alloca_r=g_alloca(_udpgate_printf_alloca_size); \
+ g_snprintf(_udpgate_printf_alloca_r,_udpgate_printf_alloca_size,(format) , ## args); \
+ (const gchar *)_udpgate_printf_alloca_r; \
+ })
+#include <stdarg.h>
+#include <glib/gmessages.h> /* for g_printf_string_upper_bound() */
+static inline gsize udpgate_nv_printf_string_upper_bound(const gchar *format,...) G_GNUC_PRINTF(1,0) G_GNUC_UNUSED;
+static inline gsize udpgate_nv_printf_string_upper_bound(const gchar *format,...)
+{
+va_list ap;
+gsize r;
+
+ va_start(ap,format);
+ r=g_printf_string_upper_bound(format,ap);
+ va_end(ap);
+ return r;
+}