From c537fa12bbd1269e43514864217bdd638f9226df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 9 Aug 2012 10:14:57 +0200 Subject: [PATCH] examples: Use GRegex instead of POSIX regex They are not available on Windows. --- tests/examples/ges-ui.c | 15 +++++++-------- tests/examples/thumbnails.c | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tests/examples/ges-ui.c b/tests/examples/ges-ui.c index 1af2764..249a0f2 100644 --- a/tests/examples/ges-ui.c +++ b/tests/examples/ges-ui.c @@ -25,7 +25,6 @@ #include #include #include -#include /* Application Data ********************************************************/ @@ -501,16 +500,16 @@ bus_message_cb (GstBus * bus, GstMessage * message, App * app) static gboolean check_time (const gchar * time) { - static regex_t re; - static gboolean compiled = FALSE; + static GRegex *re = NULL; - if (!compiled) { - compiled = TRUE; - regcomp (&re, "^[0-9][0-9]:[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?$", - REG_EXTENDED | REG_NOSUB); + if (!re) { + if (NULL == (re = + g_regex_new ("^[0-9][0-9]:[0-5][0-9]:[0-5][0-9](\\.[0-9]+)?$", + G_REGEX_EXTENDED, 0, NULL))) + return FALSE; } - if (!regexec (&re, time, (size_t) 0, NULL, 0)) + if (g_regex_match (re, time, 0, NULL)) return TRUE; return FALSE; } diff --git a/tests/examples/thumbnails.c b/tests/examples/thumbnails.c index 2a64575..601e187 100644 --- a/tests/examples/thumbnails.c +++ b/tests/examples/thumbnails.c @@ -28,7 +28,6 @@ #include #include #include -#include /* GLOBAL VARIABLE */ static guint repeat = 0; -- 2.7.4