[vlc-commits] [Git][videolan/vlc][master] 2 commits: core: move config_AutoSaveConfigFile in core.c
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Mar 26 15:48:09 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
89afe265 by Steve Lhomme at 2022-03-26T15:36:24+00:00
core: move config_AutoSaveConfigFile in core.c
No functional changes.
- - - - -
08c9fc60 by Steve Lhomme at 2022-03-26T15:36:24+00:00
core: avoid sharing config_dirty
Make it static in core.c, it's dirty enough not to share it.
- - - - -
3 changed files:
- src/config/configuration.h
- src/config/core.c
- src/config/file.c
Changes:
=====================================
src/config/configuration.h
=====================================
@@ -69,7 +69,6 @@ int config_SortConfig (void);
void config_UnsortConfig (void);
extern vlc_mutex_t config_lock;
-extern _Atomic bool config_dirty;
bool config_IsSafe (const char *);
=====================================
src/config/core.c
=====================================
@@ -40,7 +40,7 @@
#include "misc/rcu.h"
vlc_mutex_t config_lock = VLC_STATIC_MUTEX;
-atomic_bool config_dirty = ATOMIC_VAR_INIT(false);
+static atomic_bool config_dirty = ATOMIC_VAR_INIT(false);
int config_GetType(const char *name)
{
@@ -516,3 +516,24 @@ void config_ResetAll(void)
vlc_mutex_unlock(&config_lock);
atomic_store_explicit(&config_dirty, true, memory_order_release);
}
+
+
+int config_AutoSaveConfigFile( vlc_object_t *p_this )
+{
+ assert( p_this );
+
+ if (!atomic_exchange_explicit(&config_dirty, false, memory_order_acquire))
+ return 0;
+
+ int ret = config_SaveConfigFile (p_this);
+
+ if (unlikely(ret != 0))
+ /*
+ * On write failure, set the dirty flag back again. While it looks
+ * racy, it really means to retry later in hope that it does not
+ * fail again. Concurrent write attempts would not succeed anyway.
+ */
+ atomic_store_explicit(&config_dirty, true, memory_order_relaxed);
+
+ return ret;
+}
=====================================
src/config/file.c
=====================================
@@ -531,23 +531,3 @@ error:
free (permanent);
return -1;
}
-
-int config_AutoSaveConfigFile( vlc_object_t *p_this )
-{
- assert( p_this );
-
- if (!atomic_exchange_explicit(&config_dirty, false, memory_order_acquire))
- return 0;
-
- int ret = config_SaveConfigFile (p_this);
-
- if (unlikely(ret != 0))
- /*
- * On write failure, set the dirty flag back again. While it looks
- * racy, it really means to retry later in hope that it does not
- * fail again. Concurrent write attempts would not succeed anyway.
- */
- atomic_store_explicit(&config_dirty, true, memory_order_relaxed);
-
- return ret;
-}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/da50ca644c97b74d4c15166d8e11fd72cf67b952...08c9fc6022b702414f7703c790eeed1aeb29d0fe
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/da50ca644c97b74d4c15166d8e11fd72cf67b952...08c9fc6022b702414f7703c790eeed1aeb29d0fe
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list