summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-12-10 17:31:26 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-12-10 17:31:26 +0000
commitbb55d3ff4d0b9f889f3c9834c10ad014f2edf9a1 (patch)
tree0f540dcfbdbdef587e182f8f597b83557f5ab525
parent0743ce0e39c1bd43ca2b473593452d21514b38a1 (diff)
downloadirssi-bb55d3ff4d0b9f889f3c9834c10ad014f2edf9a1.zip
A few fixes to make irssi work with garbage collected GLIB.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3055 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/common.h4
-rw-r--r--src/fe-common/core/fe-common-core.c7
-rw-r--r--src/fe-text/textbuffer-reformat.c3
-rw-r--r--src/irc/core/irc-servers.c2
4 files changed, 12 insertions, 4 deletions
diff --git a/src/common.h b/src/common.h
index 66af15cf..085125a5 100644
--- a/src/common.h
+++ b/src/common.h
@@ -52,6 +52,10 @@
# include <gmodule.h>
#endif
+#ifdef USE_GC
+# define g_free(x) G_STMT_START { (x) = NULL; } G_STMT_END
+#endif
+
#if defined (UOFF_T_INT)
typedef unsigned int uoff_t;
#elif defined (UOFF_T_LONG)
diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c
index aa830350..49c8db87 100644
--- a/src/fe-common/core/fe-common-core.c
+++ b/src/fe-common/core/fe-common-core.c
@@ -106,7 +106,8 @@ static void sig_connected(SERVER_REC *server)
static void sig_disconnected(SERVER_REC *server)
{
- g_free(MODULE_DATA(server));
+ void *data = MODULE_DATA(server);
+ g_free(data);
MODULE_DATA_UNSET(server);
}
@@ -117,7 +118,9 @@ static void sig_channel_created(CHANNEL_REC *channel)
static void sig_channel_destroyed(CHANNEL_REC *channel)
{
- g_free(MODULE_DATA(channel));
+ void *data = MODULE_DATA(channel);
+
+ g_free(data);
MODULE_DATA_UNSET(channel);
}
diff --git a/src/fe-text/textbuffer-reformat.c b/src/fe-text/textbuffer-reformat.c
index 62f17f0d..81c4421c 100644
--- a/src/fe-text/textbuffer-reformat.c
+++ b/src/fe-text/textbuffer-reformat.c
@@ -87,7 +87,8 @@ static char *textbuffer_line_get_format(WINDOW_REC *window, LINE_REC *line,
text = (const unsigned char *) line->text;
/* skip the beginning of the line until we find the format */
- g_free(line_read_format(&text));
+ format_name = line_read_format(&text);
+ g_free(format_name);
if (text[1] == LINE_CMD_FORMAT_CONT) {
if (raw != NULL) {
g_string_append_c(raw, '\0');
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 8a3f5bed..b1a7b007 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -373,8 +373,8 @@ static void server_cmd_timeout(IRC_SERVER_REC *server, GTimeVal *now)
server_redirect_command(server, cmd, redirect);
/* remove from queue */
- g_free(cmd);
server->cmdqueue = g_slist_remove(server->cmdqueue, cmd);
+ g_free(cmd);
link = server->cmdqueue;
server->cmdqueue = g_slist_remove_link(server->cmdqueue, link);