examples: Use GRegex instead of POSIX regex

They are not available on Windows.
This commit is contained in:
Sebastian Dröge 2012-08-09 10:14:57 +02:00
parent 7f3ba3d9f8
commit c537fa12bb
2 changed files with 7 additions and 9 deletions

View file

@ -25,7 +25,6 @@
#include <glib.h>
#include <glib/gprintf.h>
#include <ges/ges.h>
#include <regex.h>
/* 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;
}

View file

@ -28,7 +28,6 @@
#include <glib/gstdio.h>
#include <ges/ges.h>
#include <gst/pbutils/encoding-profile.h>
#include <regex.h>
/* GLOBAL VARIABLE */
static guint repeat = 0;