diff --git a/src/dialogs/colorscheme.c b/src/dialogs/colorscheme.c
index ebd5de7..28e0673 100644
--- a/src/dialogs/colorscheme.c
+++ b/src/dialogs/colorscheme.c
@@ -327,10 +327,9 @@
{
if(!gdk_rgba_equal(colora+f,colorb+f))
{
-/*
#ifdef DEBUG
- g_autofree gchar * cla = gdk_rgba_to_string(colora+f);
- g_autofree gchar * clb = gdk_rgba_to_string(colorb+f);
+ v3270_autofree gchar * cla = gdk_rgba_to_string(colora+f);
+ v3270_autofree gchar * clb = gdk_rgba_to_string(colorb+f);
debug(
"diff on %d of %d %s - %s",
@@ -340,7 +339,6 @@
clb
);
#endif // DEBUG
-*/
return FALSE;
}
}
@@ -367,7 +365,7 @@
if(f)
g_string_append_c(str,';');
- g_autofree gchar * color = gdk_rgba_to_string(clr+f);
+ v3270_autofree gchar * color = gdk_rgba_to_string(clr+f);
g_string_append_printf(str,"%s",color);
}
diff --git a/src/dialogs/security.c b/src/dialogs/security.c
index 14a466b..a87ad0f 100644
--- a/src/dialogs/security.c
+++ b/src/dialogs/security.c
@@ -93,7 +93,7 @@
2,2
);
- g_autofree gchar * message = g_strdup_printf("%s",lib3270_get_ssl_state_message(hSession));
+ v3270_autofree gchar * message = g_strdup_printf("%s",lib3270_get_ssl_state_message(hSession));
gtk_grid_attach(
grid,
label_new(message),
diff --git a/src/include/v3270.h b/src/include/v3270.h
index 09e06b7..253e489 100644
--- a/src/include/v3270.h
+++ b/src/include/v3270.h
@@ -31,12 +31,30 @@
#ifndef V3270_H_INCLUDED
+ #define V3270_H_INCLUDED 1
+
+ #include
#include
#include
#include
#include
- #define V3270_H_INCLUDED 1
+ #if GLIB_CHECK_VERSION(2,44,0)
+
+ #define v3270_autofree g_autofree
+
+ #else
+
+ // Reference: https://github.com/ImageMagick/glib/blob/master/glib/glib-autocleanups.h
+ static inline void v3270_autoptr_cleanup_generic_gfree(void *p)
+ {
+ void **pp = (void**)p;
+ g_free (*pp);
+ }
+
+ #define v3270_autofree __attribute__((cleanup(v3270_autoptr_cleanup_generic_gfree)))
+
+ #endif // GLIB(2,44,0)
G_BEGIN_DECLS
--
libgit2 0.21.2