]> jfr.im git - irc/irssi/irssi.git/commitdiff
compat for glib 2.55
authorAilin Nemui <redacted>
Sat, 14 Aug 2021 20:43:50 +0000 (22:43 +0200)
committerAilin Nemui <redacted>
Sun, 15 Aug 2021 13:57:34 +0000 (15:57 +0200)
src/core/misc.c
src/core/misc.h
src/fe-text/textbuffer-formats.c

index c66bbd6d417bf3040f6b98e2f26721d46537ca53..f0bbf4e009f12520e2f283eaca59ffceb94c3d3c 100644 (file)
@@ -95,7 +95,6 @@ int i_input_add_poll(int fd, int priority, int condition, GInputFunction functio
 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2)
 {
-#pragma GCC diagnostic pop
        if (tv1->tv_sec < tv2->tv_sec)
                return -1;
        if (tv1->tv_sec > tv2->tv_sec)
@@ -105,11 +104,8 @@ int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2)
                tv1->tv_usec > tv2->tv_usec ? 1 : 0;
 }
 
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2)
 {
-#pragma GCC diagnostic pop
        long secs, usecs;
 
        secs = tv1->tv_sec - tv2->tv_sec;
@@ -122,6 +118,22 @@ long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2)
 
        return usecs;
 }
+#pragma GCC diagnostic pop
+
+#if GLIB_CHECK_VERSION(2, 56, 0)
+/* nothing */
+#else
+/* compatibility code for old GLib */
+GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz)
+{
+       GTimeVal time;
+       if (g_time_val_from_iso8601(iso_date, &time)) {
+               return g_date_time_new_from_timeval_utc(&time);
+       } else {
+               return NULL;
+       }
+}
+#endif
 
 int find_substr(const char *list, const char *item)
 {
index 76f5644bb5dbaef1f71170f2006aea494fd4c9b8..622470f7835f98583b5c4c714e5af30b6ef0dbf6 100644 (file)
@@ -19,6 +19,13 @@ int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATED;
 long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATED;
 #pragma GCC diagnostic pop
 
+#if GLIB_CHECK_VERSION(2, 56, 0)
+/* nothing */
+#else
+/* compatibility code for old GLib */
+GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz);
+#endif
+
 GSList *i_slist_find_string(GSList *list, const char *key);
 GSList *i_slist_find_icase_string(GSList *list, const char *key);
 GList *i_list_find_string(GList *list, const char *key);
index 5b15313f75638c236a4b074704826c335f0d1f26..20abc0dfb8800d3ba9ed33de4146dd6ea708fcd0 100644 (file)
@@ -1,6 +1,7 @@
 #include "module.h"
 #include <irssi/src/core/expandos.h>
 #include <irssi/src/core/levels.h>
+#include <irssi/src/core/misc.h>
 #include <irssi/src/core/refstrings.h>
 #include <irssi/src/core/servers.h>
 #include <irssi/src/core/settings.h>
@@ -18,21 +19,6 @@ gboolean scrollback_format;
 gboolean show_server_time;
 int signal_gui_render_line_text;
 
-#if GLIB_CHECK_VERSION(2, 56, 0)
-/* nothing */
-#else
-/* compatibility code for old GLib */
-static GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz)
-{
-       GTimeVal time;
-       if (g_time_val_from_iso8601(iso_date, &time)) {
-               return g_date_time_new_from_timeval_utc(&time);
-       } else {
-               return NULL;
-       }
-}
-#endif
-
 static void collector_free(GSList **collector)
 {
        while (*collector) {