aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.c
diff options
context:
space:
mode:
Diffstat (limited to 'uzbl.c')
-rw-r--r--uzbl.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/uzbl.c b/uzbl.c
index 3cec514..f691445 100644
--- a/uzbl.c
+++ b/uzbl.c
@@ -180,6 +180,7 @@ clean_up(void) {
if (uzbl.behave.socket_dir)
unlink (uzbl.comm.socket_path);
+ g_free(uzbl.state.executable_path);
g_string_free(uzbl.state.keycmd, TRUE);
g_hash_table_destroy(uzbl.bindings);
g_hash_table_destroy(uzbl.behave.commands);
@@ -222,7 +223,7 @@ create_web_view_cb (WebKitWebView *web_view, WebKitWebFrame *frame, gpointer us
(void) web_view;
(void) frame;
(void) user_data;
- if (uzbl.state.selected_url[0]!=0) {
+ if (uzbl.state.selected_url != NULL) {
if (uzbl.state.verbose)
printf("\nNew web view -> %s\n",uzbl.state.selected_url);
new_window_load_uri(uzbl.state.selected_url);
@@ -311,9 +312,10 @@ link_hover_cb (WebKitWebView* page, const gchar* title, const gchar* link, gpoin
(void) title;
(void) data;
//Set selected_url state variable
- uzbl.state.selected_url[0] = '\0';
+ g_free(uzbl.state.selected_url);
+ uzbl.state.selected_url = NULL;
if (link) {
- strcpy (uzbl.state.selected_url, link);
+ uzbl.state.selected_url = g_strdup(link);
}
update_title();
}
@@ -493,15 +495,17 @@ run_js (WebKitWebView * web_view, const gchar *param) {
static void
search_text (WebKitWebView *page, const char *param, const gboolean forward) {
if ((param) && (param[0] != '\0')) {
- strcpy(uzbl.state.searchtx, param);
+ uzbl.state.searchtx = g_strdup(param);
}
- if (uzbl.state.searchtx[0] != '\0') {
+ if (uzbl.state.searchtx != NULL) {
if (uzbl.state.verbose)
printf ("Searching: %s\n", uzbl.state.searchtx);
webkit_web_view_unmark_text_matches (page);
webkit_web_view_mark_text_matches (page, uzbl.state.searchtx, FALSE, 0);
webkit_web_view_set_highlight_text_matches (page, TRUE);
webkit_web_view_search_text (page, uzbl.state.searchtx, FALSE, forward, TRUE);
+ g_free(uzbl.state.searchtx);
+ uzbl.state.searchtx = NULL;
}
}
@@ -1679,7 +1683,9 @@ main (int argc, char* argv[]) {
if (!g_thread_supported ())
g_thread_init (NULL);
- strcpy(uzbl.state.executable_path,argv[0]);
+ uzbl.state.executable_path = g_strdup(argv[0]);
+ uzbl.state.selected_url = NULL;
+ uzbl.state.searchtx = NULL;
GOptionContext* context = g_option_context_new ("- some stuff here maybe someday");
g_option_context_add_main_entries (context, entries, NULL);