diff --git a/js/jsd/jsd.h b/js/jsd/jsd.h index 2c6ada6a5da..c1894d2a9ff 100644 --- a/js/jsd/jsd.h +++ b/js/jsd/jsd.h @@ -590,7 +590,7 @@ jsd_AddFullSourceText(JSDContext* jsdc, extern void jsd_DestroyAllSources(JSDContext* jsdc); -extern const char* +extern char* jsd_BuildNormalizedURL(const char* url_string); extern void diff --git a/js/jsd/jsd_text.c b/js/jsd/jsd_text.c index 16def17f377..80804aa10fe 100644 --- a/js/jsd/jsd_text.c +++ b/js/jsd/jsd_text.c @@ -111,13 +111,13 @@ _appendText(JSDContext* jsdc, JSDSourceText* jsdsrc, } static JSDSourceText* -_newSource(JSDContext* jsdc, const char* url) +_newSource(JSDContext* jsdc, char* url) { JSDSourceText* jsdsrc = (JSDSourceText*)calloc(1,sizeof(JSDSourceText)); if( ! jsdsrc ) return NULL; - jsdsrc->url = (char*) url; /* already a copy */ + jsdsrc->url = url; jsdsrc->status = JSD_SOURCE_INITED; jsdsrc->dirty = JS_TRUE; jsdsrc->alterCount = jsdc->sourceAlterCount++ ; @@ -142,7 +142,7 @@ _removeSource(JSDContext* jsdc, JSDSourceText* jsdsrc) } static JSDSourceText* -_addSource(JSDContext* jsdc, const char* url) +_addSource(JSDContext* jsdc, char* url) { JSDSourceText* jsdsrc = _newSource(jsdc, url); if( ! jsdsrc ) @@ -213,7 +213,7 @@ strncasecomp (const char* one, const char * two, int n) static char file_url_prefix[] = "file:"; #define FILE_URL_PREFIX_LEN (sizeof file_url_prefix - 1) -const char* +char* jsd_BuildNormalizedURL( const char* url_string ) { char *new_url_string; @@ -378,7 +378,7 @@ JSDSourceText* jsd_NewSourceText(JSDContext* jsdc, const char* url) { JSDSourceText* jsdsrc; - const char* new_url_string; + char* new_url_string; JSD_LOCK_SOURCE_TEXT(jsdc); @@ -396,9 +396,7 @@ jsd_NewSourceText(JSDContext* jsdc, const char* url) { if( jsdsrc->doingEval ) { -#ifdef LIVEWIRE - free((char*)new_url_string); -#endif + free(new_url_string); JSD_UNLOCK_SOURCE_TEXT(jsdc); return NULL; } diff --git a/js/jsd/jsdebug.h b/js/jsd/jsdebug.h index 5e597c9057f..ce0a3dc4e7a 100644 --- a/js/jsd/jsdebug.h +++ b/js/jsd/jsdebug.h @@ -663,6 +663,8 @@ JSD_DestroyAllSources( JSDContext* jsdc ); * Add a new item for a given URL. If an iten already exists for the given URL * then the old item is removed. * 'url' may not be NULL. +* +* ifdef LIVEWIRE url is treated as a char* and ownership is claimed by jsd */ extern JSD_PUBLIC_API(JSDSourceText*) JSD_NewSourceText(JSDContext* jsdc, const char* url);