g_snprintf(_captive_printf_alloca_r,_captive_printf_alloca_size,(format) , ## args); \
(const gchar *)_captive_printf_alloca_r; \
})
-static inline gsize captive_nv_printf_string_upper_bound(const gchar *format,...) G_GNUC_PRINTF(1,0);
+static inline gsize captive_nv_printf_string_upper_bound(const gchar *format,...) G_GNUC_PRINTF(1,0) G_GNUC_UNUSED;
static inline gsize captive_nv_printf_string_upper_bound(const gchar *format,...)
{
va_list ap;
}
+/**
+ * captive_strdup_alloca:
+ * @string: #const #gchar * string to duplicate.
+ *
+ * Macro to do g_strdup() equivalent in g_alloca() style.
+ *
+ * Memory is allocated on the stack frame by g_alloca() and it will be automatically deallocated
+ * during exit of current function (or current block if variable sized variables present there).
+ * You cannot deallocate or reallocate such memory in any other way.
+ *
+ * @Returns: Duplicated @string. You may modify its items if the length is not changed.
+ */
+#define captive_strdup_alloca(string) ({ \
+ const gchar *_captive_strdup_alloca_string=(string); \
+ gchar *_captive_strdup_alloca_r=g_alloca(strlen(_captive_strdup_alloca_string)+1); \
+ strcpy(_captive_strdup_alloca_r,_captive_strdup_alloca_string); \
+ (const gchar *)(_captive_strdup_alloca_string); \
+ })
+
G_END_DECLS