summaryrefslogtreecommitdiff
path: root/src/load.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/load.c')
-rw-r--r--src/load.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/src/load.c b/src/load.c
index c2a5aa7..fb0bca0 100644
--- a/src/load.c
+++ b/src/load.c
@@ -53,37 +53,36 @@ dlopenLADSPA(const char * pcFilename, int iFlag) {
LD_LIBRARY_PATH, whereas the LADSPA_PATH is the correct place
to search. */
- pcLADSPAPath = getenv("LADSPA_PATH");
-
- if (pcLADSPAPath) {
-
- pcStart = pcLADSPAPath;
- while (*pcStart != '\0') {
- pcEnd = pcStart;
- while (*pcEnd != ':' && *pcEnd != '\0')
- pcEnd++;
-
- pcBuffer = malloc(iFilenameLength + 2 + (pcEnd - pcStart));
- if (pcEnd > pcStart)
- strncpy(pcBuffer, pcStart, pcEnd - pcStart);
- iNeedSlash = 0;
- if (pcEnd > pcStart)
- if (*(pcEnd - 1) != '/') {
- iNeedSlash = 1;
- pcBuffer[pcEnd - pcStart] = '/';
- }
- strcpy(pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename);
-
- pvResult = dlopen(pcBuffer, iFlag);
-
- free(pcBuffer);
- if (pvResult != NULL)
- return pvResult;
-
- pcStart = pcEnd;
- if (*pcStart == ':')
- pcStart++;
- }
+ pcLADSPAPath = getenv("LADSPA_PATH");
+ if (pcLADSPAPath == NULL)
+ pcLADSPAPath = EXPAND_AND_STRINGIFY(DEFAULT_LADSPA_PATH);
+
+ pcStart = pcLADSPAPath;
+ while (*pcStart != '\0') {
+ pcEnd = pcStart;
+ while (*pcEnd != ':' && *pcEnd != '\0')
+ pcEnd++;
+
+ pcBuffer = malloc(iFilenameLength + 2 + (pcEnd - pcStart));
+ if (pcEnd > pcStart)
+ strncpy(pcBuffer, pcStart, pcEnd - pcStart);
+ iNeedSlash = 0;
+ if (pcEnd > pcStart)
+ if (*(pcEnd - 1) != '/') {
+ iNeedSlash = 1;
+ pcBuffer[pcEnd - pcStart] = '/';
+ }
+ strcpy(pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename);
+
+ pvResult = dlopen(pcBuffer, iFlag);
+
+ free(pcBuffer);
+ if (pvResult != NULL)
+ return pvResult;
+
+ pcStart = pcEnd;
+ if (*pcStart == ':')
+ pcStart++;
}
}