summaryrefslogtreecommitdiff
path: root/pltmeta.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-05-18 11:42:23 +0200
committerGravatar waker <wakeroid@gmail.com>2012-05-18 11:42:23 +0200
commitf81a65b6b502adb2f1d071d2f58a824944841bf3 (patch)
tree38887c2595781195f1e21eae492e53fee915b4ac /pltmeta.c
parent6b97a160c2db19b808cbfc320a8a92da203d49ca (diff)
fixed plt_find_meta calls to use pl_lock
Diffstat (limited to 'pltmeta.c')
-rw-r--r--pltmeta.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pltmeta.c b/pltmeta.c
index 63c7279c..fac97b37 100644
--- a/pltmeta.c
+++ b/pltmeta.c
@@ -64,6 +64,7 @@ plt_add_meta (playlist_t *it, const char *key, const char *value) {
void
plt_append_meta (playlist_t *it, const char *key, const char *value) {
+ pl_lock ();
const char *old = plt_find_meta (it, key);
size_t newlen = strlen (value);
if (!old) {
@@ -85,6 +86,7 @@ plt_append_meta (playlist_t *it, const char *key, const char *value) {
}
if (len == newlen && !memcmp (str, value, len)) {
+ pl_unlock ();
return;
}
@@ -95,6 +97,7 @@ plt_append_meta (playlist_t *it, const char *key, const char *value) {
snprintf (out, sz, "%s\n%s", old, value);
plt_replace_meta (it, key, out);
}
+ pl_unlock ();
}
void
@@ -170,14 +173,20 @@ plt_find_meta (playlist_t *it, const char *key) {
int
plt_find_meta_int (playlist_t *it, const char *key, int def) {
+ pl_lock ();
const char *val = plt_find_meta (it, key);
- return val ? atoi (val) : def;
+ int res = val ? atoi (val) : def;
+ pl_unlock ();
+ return res;
}
float
plt_find_meta_float (playlist_t *it, const char *key, float def) {
+ pl_lock ();
const char *val = plt_find_meta (it, key);
- return val ? atof (val) : def;
+ float res = val ? atof (val) : def;
+ pl_unlock ();
+ return res;
}
DB_metaInfo_t *