summaryrefslogtreecommitdiffstats
path: root/src/world.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-28 03:39:39 +0000
committerDavid Robillard <d@drobilla.net>2011-03-28 03:39:39 +0000
commit799264dcf2ced28bb8d2bdb25dcc084887a6c9da (patch)
tree71e3bff3bca55e118f20cc94e7133c24acd17367 /src/world.c
parentef2a76258d12852729d728cd23fe15ebab88c277 (diff)
downloadlilv-799264dcf2ced28bb8d2bdb25dcc084887a6c9da.tar.gz
lilv-799264dcf2ced28bb8d2bdb25dcc084887a6c9da.tar.bz2
lilv-799264dcf2ced28bb8d2bdb25dcc084887a6c9da.zip
Fix LV2_PATH parsing.
git-svn-id: http://svn.drobilla.net/lad/trunk/slv2@3131 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/world.c')
-rw-r--r--src/world.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/world.c b/src/world.c
index ea2e20c..39262e6 100644
--- a/src/world.c
+++ b/src/world.c
@@ -26,6 +26,7 @@
#define _XOPEN_SOURCE 500
#include <assert.h>
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
@@ -577,17 +578,15 @@ is_path_sep(char c)
return c == SLV2_PATH_SEP[0];
}
-const char*
-last_path_sep(const char* path)
+static const char*
+first_path_sep(const char* path)
{
- const size_t len = strlen(path);
- const char* last_sep = path + len;
- for (; last_sep > path; --last_sep) {
- if (is_path_sep(*last_sep)) {
- break;
+ for (const char* p = path; *p != '\0'; ++p) {
+ if (is_path_sep(*p)) {
+ return p;
}
}
- return is_path_sep(*last_sep) ? last_sep : NULL;
+ return NULL;
}
/** Load all bundles found in @a lv2_path.
@@ -600,7 +599,7 @@ slv2_world_load_path(SLV2World world,
const char* lv2_path)
{
while (lv2_path[0] != '\0') {
- const char* const sep = last_path_sep(lv2_path);
+ const char* const sep = first_path_sep(lv2_path);
if (sep) {
const size_t dir_len = sep - lv2_path;
char* const dir = malloc(dir_len + 1);