1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[quickjs] Added location_goto_const to avoid some warnings

This commit is contained in:
Witold Filipczyk 2022-01-14 19:48:40 +01:00
parent b9f696ffe5
commit 2237cb002d
4 changed files with 23 additions and 11 deletions

View File

@ -740,6 +740,17 @@ delayed_goto(void *data)
mem_free(deg);
}
void
location_goto_const(struct document_view *doc_view, const char *url)
{
char *url2 = stracpy(url);
if (url2) {
location_goto(doc_view, url2);
mem_free(url2);
}
}
void
location_goto(struct document_view *doc_view, char *url)
{

View File

@ -154,6 +154,7 @@ void toggle_ecmascript(struct session *ses);
void *document_parse(struct document *document);
void free_document(void *doc);
void location_goto(struct document_view *doc_view, char *url);
void location_goto_const(struct document_view *doc_view, const char *url);
extern char *console_error_filename;
extern char *console_log_filename;

View File

@ -655,7 +655,7 @@ js_document_set_property_location(JSContext *ctx, JSValueConst this_val, JSValue
return JS_EXCEPTION;
}
location_goto(doc_view, url);
location_goto_const(doc_view, url);
JS_FreeCString(ctx, url);
return JS_UNDEFINED;
@ -885,7 +885,7 @@ js_document_set_property_url(JSContext *ctx, JSValueConst this_val, JSValue val)
if (!url) {
return JS_EXCEPTION;
}
location_goto(doc_view, url);
location_goto_const(doc_view, url);
JS_FreeCString(ctx, url);
return JS_UNDEFINED;

View File

@ -355,7 +355,7 @@ js_location_set_property_hash(JSContext *ctx, JSValueConst this_val, JSValue val
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -383,7 +383,7 @@ js_location_set_property_host(JSContext *ctx, JSValueConst this_val, JSValue val
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -411,7 +411,7 @@ js_location_set_property_hostname(JSContext *ctx, JSValueConst this_val, JSValue
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -439,7 +439,7 @@ js_location_set_property_href(JSContext *ctx, JSValueConst this_val, JSValue val
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -467,7 +467,7 @@ js_location_set_property_pathname(JSContext *ctx, JSValueConst this_val, JSValue
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -495,7 +495,7 @@ js_location_set_property_port(JSContext *ctx, JSValueConst this_val, JSValue val
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -523,7 +523,7 @@ js_location_set_property_protocol(JSContext *ctx, JSValueConst this_val, JSValue
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -551,7 +551,7 @@ js_location_set_property_search(JSContext *ctx, JSValueConst this_val, JSValue v
if (!str) {
return JS_EXCEPTION;
}
location_goto(vs->doc_view, str);
location_goto_const(vs->doc_view, str);
JS_FreeCString(ctx, str);
return JS_UNDEFINED;
@ -572,7 +572,7 @@ js_location_reload(JSContext *ctx, JSValueConst this_val, int argc, JSValueConst
#endif
return JS_EXCEPTION;
}
location_goto(vs->doc_view, "");
location_goto_const(vs->doc_view, "");
return JS_UNDEFINED;
}