aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Warmerdam <warmerdam@pobox.com>2007-07-06 14:58:03 +0000
committerFrank Warmerdam <warmerdam@pobox.com>2007-07-06 14:58:03 +0000
commit97313ea5ff14be6f771d38eb5b777eea76105541 (patch)
treec2f59c103fe16b33b90ce4785d66001ccb3e3ea7 /src
parentd41f9896cfdc205e2f9af318c1416717f4671519 (diff)
downloadPROJ-97313ea5ff14be6f771d38eb5b777eea76105541.tar.gz
PROJ-97313ea5ff14be6f771d38eb5b777eea76105541.zip
improve searchpath clearning with pj_set_searchpath()
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@1400 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src')
-rw-r--r--src/pj_open_lib.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/pj_open_lib.c b/src/pj_open_lib.c
index 1340654c..ffea6025 100644
--- a/src/pj_open_lib.c
+++ b/src/pj_open_lib.c
@@ -31,6 +31,9 @@
******************************************************************************
*
* $Log$
+ * Revision 1.9 2007/07/06 14:58:03 fwarmerdam
+ * improve searchpath clearning with pj_set_searchpath()
+ *
* Revision 1.8 2007/03/11 17:03:18 fwarmerdam
* support drive letter prefixes on win32 and related fixes (bug 1499)
*
@@ -77,7 +80,8 @@ void pj_set_finder( const char *(*new_finder)(const char *) )
/* pj_set_searchpath() */
/* */
/* Path control for callers that can't practically provide */
-/* pj_set_finder() style callbacks. */
+/* pj_set_finder() style callbacks. Call with (0,NULL) as args */
+/* to clear the searchpath set. */
/************************************************************************/
void pj_set_searchpath ( int count, const char **path )
@@ -95,13 +99,16 @@ void pj_set_searchpath ( int count, const char **path )
search_path = NULL;
}
- search_path = pj_malloc(sizeof *search_path * count);
- for (i = 0; i < count; i++)
+ if( count > 0 )
{
- search_path[i] = pj_malloc(strlen(path[i]) + 1);
- strcpy(search_path[i], path[i]);
+ search_path = pj_malloc(sizeof *search_path * count);
+ for (i = 0; i < count; i++)
+ {
+ search_path[i] = pj_malloc(strlen(path[i]) + 1);
+ strcpy(search_path[i], path[i]);
+ }
}
-
+
path_count = count;
}