summaryrefslogtreecommitdiff
path: root/src/history.c
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-04 02:48:25 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-04 02:48:25 +0100
commit5dcd243c55447099e4ff353fafbbad2a02836b0c (patch)
tree14a37615c449b2c8c245ce93dd547ffcf2316298 /src/history.c
parent41dc897f6dcf7b0be0832f95d624ef91b68f7edf (diff)
downloadratpoison-5dcd243c55447099e4ff353fafbbad2a02836b0c.zip
More decls/code separation. More spacing too.
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/history.c b/src/history.c
index cf8bfad..183a427 100644
--- a/src/history.c
+++ b/src/history.c
@@ -181,7 +181,7 @@ history_add (int history_id, const char *item)
void
history_load (void)
{
- char *filename = get_history_filename ();
+ char *filename;
FILE *f;
char *line = NULL;
size_t s = 0;
@@ -194,8 +194,10 @@ history_load (void)
histories[id].count = 0;
}
+ filename = get_history_filename ();
if (!filename)
return;
+
f = fopen (filename, "r");
if (!f) {
PRINT_DEBUG (("ratpoison: could not read %s - %s\n", filename, strerror (errno)));
@@ -227,15 +229,18 @@ history_load (void)
void
history_save (void)
{
- char *filename = get_history_filename ();
+ char *filename;
FILE *f;
struct history_item *item;
if (!defaults.history_size)
return;
+ filename = get_history_filename ();
+
if (!filename)
return;
+
f = fopen (filename, "w");
if (!f) {
PRINT_DEBUG (("ratpoison: could not write %s - %s\n", filename, strerror (errno)));