diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2008-03-09 23:03:45 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2008-03-09 23:03:45 +0000 |
commit | 37381fe1bc8429dfbee62f7520181d48dd24d9c8 (patch) | |
tree | 8e1f25001f1812fa80cbe13a3f929cfc50053c9b | |
parent | ef47cde2b9a9ebb107a5bcf383d0b506b66110f2 (diff) | |
download | irssi-37381fe1bc8429dfbee62f7520181d48dd24d9c8.zip |
Simplify history handling in key_send_line.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4745 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-text/gui-readline.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fe-text/gui-readline.c b/src/fe-text/gui-readline.c index 09802f17..5ef25021 100644 --- a/src/fe-text/gui-readline.c +++ b/src/fe-text/gui-readline.c @@ -535,13 +535,14 @@ static void sig_gui_key_pressed(gpointer keyp) static void key_send_line(void) { HISTORY_REC *history; - char *str, *add_history; + char *str; + int add_history; str = gui_entry_get_text(active_entry); /* we can't use gui_entry_get_text() later, since the entry might have been destroyed after we get back */ - add_history = *str == '\0' ? NULL : g_strdup(str); + add_history = *str != '\0'; history = command_history_current(active_win); if (redir == NULL) { @@ -550,15 +551,14 @@ static void key_send_line(void) active_win->active); } else { if (redir->flags & ENTRY_REDIRECT_FLAG_HIDDEN) - g_free_and_null(add_history); + add_history = 0; handle_entry_redirect(str); } - if (add_history != NULL) { + if (add_history) { history = command_history_find(history); if (history != NULL) - command_history_add(history, add_history); - g_free(add_history); + command_history_add(history, str); } if (active_entry != NULL) |