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

/dehilight fixes

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@203 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-05-09 13:14:07 +00:00 committed by cras
parent ef6b0a1ad9
commit e33da25e8a

View File

@ -41,6 +41,8 @@ static void hilight_add_config(HILIGHT_REC *rec)
{ {
CONFIG_NODE *node; CONFIG_NODE *node;
g_return_if_fail(rec != NULL);
node = iconfig_node_traverse("(hilights", TRUE); node = iconfig_node_traverse("(hilights", TRUE);
node = config_node_section(node, NULL, NODE_TYPE_BLOCK); node = config_node_section(node, NULL, NODE_TYPE_BLOCK);
@ -61,12 +63,16 @@ static void hilight_remove_config(HILIGHT_REC *rec)
{ {
CONFIG_NODE *node; CONFIG_NODE *node;
g_return_if_fail(rec != NULL);
node = iconfig_node_traverse("hilights", FALSE); node = iconfig_node_traverse("hilights", FALSE);
if (node != NULL) config_node_list_remove(node, g_slist_index(hilights, rec)); if (node != NULL) config_node_list_remove(node, g_slist_index(hilights, rec));
} }
static void hilight_destroy(HILIGHT_REC *rec) static void hilight_destroy(HILIGHT_REC *rec)
{ {
g_return_if_fail(rec != NULL);
g_free(rec->text); g_free(rec->text);
g_free_not_null(rec->color); g_free_not_null(rec->color);
g_free(rec); g_free(rec);
@ -81,6 +87,8 @@ static void hilights_destroy_all(void)
static void hilight_remove(HILIGHT_REC *rec) static void hilight_remove(HILIGHT_REC *rec)
{ {
g_return_if_fail(rec != NULL);
hilight_remove_config(rec); hilight_remove_config(rec);
hilights = g_slist_remove(hilights, rec); hilights = g_slist_remove(hilights, rec);
hilight_destroy(rec); hilight_destroy(rec);
@ -324,10 +332,11 @@ static void cmd_dehilight(const char *data)
if (rec == NULL) if (rec == NULL)
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_HILIGHT_NOT_FOUND, data); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_HILIGHT_NOT_FOUND, data);
else else {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_HILIGHT_REMOVED, rec->text); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, IRCTXT_HILIGHT_REMOVED, rec->text);
hilight_remove(rec); hilight_remove(rec);
} }
}
void hilight_text_init(void) void hilight_text_init(void)
{ {