1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00:00

compat for glib 2.55

This commit is contained in:
Ailin Nemui 2021-08-14 22:43:50 +02:00
parent fdd61f5898
commit 6a33139939
3 changed files with 24 additions and 19 deletions

View 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)
{

View 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);

View 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) {