Adapted titlechange()

Do not copy title strings, just carry over the const pointer.
This commit is contained in:
Quentin Rameau 2015-11-18 17:42:51 +01:00
parent 0f3e3bf669
commit 60f574e4b7

13
surf.c
View file

@ -57,7 +57,7 @@ typedef struct Client {
Window xid; Window xid;
WebKitWebView *view; WebKitWebView *view;
WebKitWebInspector *inspector; WebKitWebInspector *inspector;
char *title, *linkhover; const char *title, *linkhover;
const char *needle; const char *needle;
gint progress; gint progress;
struct Client *next; struct Client *next;
@ -179,7 +179,7 @@ static void setup(void);
static void sigchld(int unused); static void sigchld(int unused);
static void spawn(Client *c, const Arg *arg); static void spawn(Client *c, const Arg *arg);
static void stop(Client *c, const Arg *arg); static void stop(Client *c, const Arg *arg);
static void titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c); static void titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c);
static void titlechangeleave(void *a, void *b, Client *c); static void titlechangeleave(void *a, void *b, Client *c);
static void toggle(Client *c, const Arg *arg); static void toggle(Client *c, const Arg *arg);
static void togglecookiepolicy(Client *c, const Arg *arg); static void togglecookiepolicy(Client *c, const Arg *arg);
@ -865,7 +865,7 @@ newview(Client *c, WebKitWebView *rv)
g_signal_connect(G_OBJECT(v), g_signal_connect(G_OBJECT(v),
"notify::title", "notify::title",
G_CALLBACK(titlechange), c); G_CALLBACK(titlechanged), c);
g_signal_connect(G_OBJECT(v), g_signal_connect(G_OBJECT(v),
"hovering-over-link", "hovering-over-link",
G_CALLBACK(linkhover), c); G_CALLBACK(linkhover), c);
@ -1277,14 +1277,11 @@ stop(Client *c, const Arg *arg)
} }
void void
titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c) titlechanged(WebKitWebView *view, GParamSpec *ps, Client *c)
{ {
const gchar *t = webkit_web_view_get_title(view); c->title = webkit_web_view_get_title(c->view);
if (t) {
c->title = copystr(&c->title, t);
updatetitle(c); updatetitle(c);
} }
}
void void
titlechangeleave(void *a, void *b, Client *c) titlechangeleave(void *a, void *b, Client *c)