Commit 53a59a9fed3f8cdc8109fc0f5b40f0b51899ddd3
1 parent
ae34e941
Exists in
master
and in
1 other branch
Fixing glib compatibility issues.
Showing
3 changed files
with
23 additions
and
7 deletions
Show diff stats
src/dialogs/colorscheme.c
@@ -327,10 +327,9 @@ | @@ -327,10 +327,9 @@ | ||
327 | { | 327 | { |
328 | if(!gdk_rgba_equal(colora+f,colorb+f)) | 328 | if(!gdk_rgba_equal(colora+f,colorb+f)) |
329 | { | 329 | { |
330 | -/* | ||
331 | #ifdef DEBUG | 330 | #ifdef DEBUG |
332 | - g_autofree gchar * cla = gdk_rgba_to_string(colora+f); | ||
333 | - g_autofree gchar * clb = gdk_rgba_to_string(colorb+f); | 331 | + v3270_autofree gchar * cla = gdk_rgba_to_string(colora+f); |
332 | + v3270_autofree gchar * clb = gdk_rgba_to_string(colorb+f); | ||
334 | 333 | ||
335 | debug( | 334 | debug( |
336 | "diff on %d of %d %s - %s", | 335 | "diff on %d of %d %s - %s", |
@@ -340,7 +339,6 @@ | @@ -340,7 +339,6 @@ | ||
340 | clb | 339 | clb |
341 | ); | 340 | ); |
342 | #endif // DEBUG | 341 | #endif // DEBUG |
343 | -*/ | ||
344 | return FALSE; | 342 | return FALSE; |
345 | } | 343 | } |
346 | } | 344 | } |
@@ -367,7 +365,7 @@ | @@ -367,7 +365,7 @@ | ||
367 | if(f) | 365 | if(f) |
368 | g_string_append_c(str,';'); | 366 | g_string_append_c(str,';'); |
369 | 367 | ||
370 | - g_autofree gchar * color = gdk_rgba_to_string(clr+f); | 368 | + v3270_autofree gchar * color = gdk_rgba_to_string(clr+f); |
371 | g_string_append_printf(str,"%s",color); | 369 | g_string_append_printf(str,"%s",color); |
372 | } | 370 | } |
373 | 371 |
src/dialogs/security.c
@@ -93,7 +93,7 @@ | @@ -93,7 +93,7 @@ | ||
93 | 2,2 | 93 | 2,2 |
94 | ); | 94 | ); |
95 | 95 | ||
96 | - g_autofree gchar * message = g_strdup_printf("<b>%s</b>",lib3270_get_ssl_state_message(hSession)); | 96 | + v3270_autofree gchar * message = g_strdup_printf("<b>%s</b>",lib3270_get_ssl_state_message(hSession)); |
97 | gtk_grid_attach( | 97 | gtk_grid_attach( |
98 | grid, | 98 | grid, |
99 | label_new(message), | 99 | label_new(message), |
src/include/v3270.h
@@ -31,12 +31,30 @@ | @@ -31,12 +31,30 @@ | ||
31 | 31 | ||
32 | #ifndef V3270_H_INCLUDED | 32 | #ifndef V3270_H_INCLUDED |
33 | 33 | ||
34 | + #define V3270_H_INCLUDED 1 | ||
35 | + | ||
36 | + #include <glib.h> | ||
34 | #include <gtk/gtk.h> | 37 | #include <gtk/gtk.h> |
35 | #include <lib3270.h> | 38 | #include <lib3270.h> |
36 | #include <lib3270/popup.h> | 39 | #include <lib3270/popup.h> |
37 | #include <lib3270/filetransfer.h> | 40 | #include <lib3270/filetransfer.h> |
38 | 41 | ||
39 | - #define V3270_H_INCLUDED 1 | 42 | + #if GLIB_CHECK_VERSION(2,44,0) |
43 | + | ||
44 | + #define v3270_autofree g_autofree | ||
45 | + | ||
46 | + #else | ||
47 | + | ||
48 | + // Reference: https://github.com/ImageMagick/glib/blob/master/glib/glib-autocleanups.h | ||
49 | + static inline void v3270_autoptr_cleanup_generic_gfree(void *p) | ||
50 | + { | ||
51 | + void **pp = (void**)p; | ||
52 | + g_free (*pp); | ||
53 | + } | ||
54 | + | ||
55 | + #define v3270_autofree __attribute__((cleanup(v3270_autoptr_cleanup_generic_gfree))) | ||
56 | + | ||
57 | + #endif // GLIB(2,44,0) | ||
40 | 58 | ||
41 | G_BEGIN_DECLS | 59 | G_BEGIN_DECLS |
42 | 60 |