From 7cb15b645c7e46af2d2155d44760aa38b31e2023 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 19 Oct 2020 09:39:13 -0700 Subject: [PATCH] Fix build with glib < 2.62 --- src/debug.c | 9 +++++++++ src/league.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/debug.c b/src/debug.c index 47c12228..0a734099 100644 --- a/src/debug.c +++ b/src/debug.c @@ -43,7 +43,11 @@ debug_print_message(gchar *format, ...) gchar buf[SMALL]; const gchar *home; FILE *fil = NULL; +#ifdef GLIB_VERSION_2_62 GDateTime *logtime; +#else + GTimeVal logtime; +#endif gchar *logtime_string; if(format != NULL) @@ -58,10 +62,15 @@ debug_print_message(gchar *format, ...) if(debug_output != DEBUG_OUT_STDOUT) { +#ifdef GLIB_VERSION_2_62 gint64 current_time = g_get_real_time(); logtime = g_date_time_new_from_unix_utc(current_time); logtime_string = g_date_time_format_iso8601(logtime); g_date_time_unref(logtime); +#else + g_get_current_time(&logtime); + logtime_string = g_time_val_to_iso8601(&logtime); +#endif sprintf(text, "%s %s\n", logtime_string, buf); g_free(logtime_string); diff --git a/src/league.c b/src/league.c index 7ad97ab2..966b83c4 100644 --- a/src/league.c +++ b/src/league.c @@ -686,7 +686,16 @@ handle_required_reserve_relegation(const TeamMove *move, GArray *team_movements) /* We have found the last relegation for this league, so * insert the new_move here. */ gint insert_index = k + 1; +#ifdef GLIB_VERSION_2_62 new_move.dest_idcs = g_array_copy(move->dest_idcs); +#else + new_move.dest_idcs = g_array_sized_new(FALSE, FALSE, + sizeof(gint), + move->dest_idcs->len); + g_array_append_vals(new_move.dest_idcs, + move->dest_idcs->data, + move->dest_idcs->len); +#endif if(debug > 70) { printf("Adding relegation of %s\n", reserve_team->name);