From 466bb18be09d2024257b46f01dcbbfa3f5190714 Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Mon, 16 Jan 2006 19:28:03 +0000 Subject: [PATCH] Move delayed_open to src/terminal/tab.c The two copies of delayed_open in src/ecmascript/spidermonkey/window.c and in src/ecmascript/see/window.c are identical, so move them to src/terminal/tab.c and eliminate the duplication. --- src/ecmascript/see/window.c | 13 ------------- src/ecmascript/spidermonkey/window.c | 11 ----------- src/terminal/tab.c | 11 +++++++++++ src/terminal/tab.h | 1 + 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/ecmascript/see/window.c b/src/ecmascript/see/window.c index fbf1b4069..51cfa45e6 100644 --- a/src/ecmascript/see/window.c +++ b/src/ecmascript/see/window.c @@ -48,7 +48,6 @@ static struct js_window_object *js_get_global_object(void *); static struct js_window_object *js_try_resolve_frame(struct document_view *, unsigned char *); -static void delayed_open(void *); static void window_get(struct SEE_interpreter *, struct SEE_object *, struct SEE_string *, struct SEE_value *); static void window_put(struct SEE_interpreter *, struct SEE_object *, struct SEE_string *, struct SEE_value *, int); static int window_canput(struct SEE_interpreter *, struct SEE_object *, struct SEE_string *); @@ -95,18 +94,6 @@ js_try_resolve_frame(struct document_view *doc_view, unsigned char *id) } -static void -delayed_open(void *data) -{ - struct delayed_open *deo = data; - - assert(deo); - open_uri_in_new_tab(deo->ses, deo->uri, 0, 0); - done_uri(deo->uri); - mem_free(deo); -} - - static void window_get(struct SEE_interpreter *interp, struct SEE_object *o, diff --git a/src/ecmascript/spidermonkey/window.c b/src/ecmascript/spidermonkey/window.c index 1bac6eebe..3661caf09 100644 --- a/src/ecmascript/spidermonkey/window.c +++ b/src/ecmascript/spidermonkey/window.c @@ -289,17 +289,6 @@ window_alert(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval return JS_TRUE; } -static void -delayed_open(void *data) -{ - struct delayed_open *deo = data; - - assert(deo); - open_uri_in_new_tab(deo->ses, deo->uri, 0, 0); - done_uri(deo->uri); - mem_free(deo); -} - static JSBool window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { diff --git a/src/terminal/tab.c b/src/terminal/tab.c index 02b8409f5..94db81352 100644 --- a/src/terminal/tab.c +++ b/src/terminal/tab.c @@ -239,6 +239,17 @@ open_uri_in_new_tab(struct session *ses, struct uri *uri, int in_background, init_session(based ? ses : NULL, ses->tab->term, uri, in_background); } +void +delayed_open(void *data) +{ + struct delayed_open *deo = data; + + assert(deo); + open_uri_in_new_tab(deo->ses, deo->uri, 0, 0); + done_uri(deo->uri); + mem_free(deo); +} + void open_current_link_in_new_tab(struct session *ses, int in_background) { diff --git a/src/terminal/tab.h b/src/terminal/tab.h index 2fa38bd56..2fbc6e72d 100644 --- a/src/terminal/tab.h +++ b/src/terminal/tab.h @@ -25,6 +25,7 @@ void close_all_tabs_but_current(struct session *ses); ((win)->type != WINDOW_NORMAL && (win) != get_current_tab((win->term))) void open_uri_in_new_tab(struct session *ses, struct uri *uri, int in_background, int based); +void delayed_open(void *); void open_current_link_in_new_tab(struct session *ses, int in_background); void move_current_tab(struct session *ses, int direction);