From 3146bdbf160463ed60a7e3ed519dfcbe6da402b9 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 27 Jul 2006 17:10:33 +0000 Subject: [PATCH] 2006-07-27 Emmanuele Bassi * clutter/clutter-feature.c: No need to call clutter_feature_init() each time: it's private and should never be seen from the outside; add a warning, just in case something screws up and calls it more than once. --- ChangeLog | 7 +++++++ clutter/clutter-feature.c | 26 +++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 583740b2e..959c4c5dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-27 Emmanuele Bassi + + * clutter/clutter-feature.c: No need to call clutter_feature_init() + each time: it's private and should never be seen from the outside; + add a warning, just in case something screws up and calls it more + than once. + 2006-07-27 Emmanuele Bassi * clutter/clutter-private.h: Move clutter_feature_init() diff --git a/clutter/clutter-feature.c b/clutter/clutter-feature.c index 6cf8c88fa..4ff4c04bc 100644 --- a/clutter/clutter-feature.c +++ b/clutter/clutter-feature.c @@ -34,8 +34,7 @@ #include "clutter-feature.h" #include "string.h" -G_LOCK_DEFINE_STATIC (__features); -static ClutterFeatureFlags __features; +static ClutterFeatureFlags __features = -1; /* Note must be called after context created */ static gboolean @@ -66,12 +65,15 @@ check_gl_extension (const gchar *name) return FALSE; } -/* HOLDS: __features lock */ -static void -clutter_feature_init_do (void) +void +clutter_feature_init (void) { - if (__features) - return; + if (__features != -1) + { + g_warning ("You should never call clutter_feature_init() " + "more than once."); + return; + } __features = 0; @@ -79,14 +81,6 @@ clutter_feature_init_do (void) __features |= CLUTTER_FEATURE_TEXTURE_RECTANGLE; } -void -clutter_feature_init (void) -{ - G_LOCK (__features); - clutter_feature_init_do (); - G_UNLOCK (__features); -} - /** * clutter_feature_available: * @feature: a #ClutterFeatureFlags @@ -101,7 +95,6 @@ clutter_feature_init (void) gboolean clutter_feature_available (ClutterFeatureFlags feature) { - clutter_feature_init (); return (__features & feature); } @@ -117,6 +110,5 @@ clutter_feature_available (ClutterFeatureFlags feature) ClutterFeatureFlags clutter_feature_all (void) { - clutter_feature_init (); return __features; }