summary refs log tree commit diff stats
path: root/src/common/history.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/history.c')
-rw-r--r--src/common/history.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/history.c b/src/common/history.c
index 1acd3327..23a8463e 100644
--- a/src/common/history.c
+++ b/src/common/history.c
@@ -18,14 +18,14 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <glib.h>
 #include "history.h"
 
 void
 history_add (struct history *his, char *text)
 {
-	if (his->lines[his->realpos])
-		free (his->lines[his->realpos]);
-	his->lines[his->realpos] = strdup (text);
+	g_free (his->lines[his->realpos]);
+	his->lines[his->realpos] = g_strdup (text);
 	his->realpos++;
 	if (his->realpos == HISTORY_SIZE)
 		his->realpos = 0;
@@ -40,7 +40,7 @@ history_free (struct history *his)
 	{
 		if (his->lines[i])
 		{
-			free (his->lines[i]);
+			g_free (his->lines[i]);
 			his->lines[i] = 0;
 		}
 	}
@@ -52,7 +52,7 @@ history_down (struct history *his)
 	int next;
 
 	if (his->pos == his->realpos)	/* allow down only after up */
-		return 0;
+		return NULL;
 	if (his->realpos == 0)
 	{
 		if (his->pos == HISTORY_SIZE - 1)
@@ -79,7 +79,7 @@ history_down (struct history *his)
 		return his->lines[his->pos];
 	}
 
-	return 0;
+	return NULL;
 }
 
 char *
@@ -90,11 +90,11 @@ history_up (struct history *his, char *current_text)
 	if (his->realpos == HISTORY_SIZE - 1)
 	{
 		if (his->pos == 0)
-			return 0;
+			return NULL;
 	} else
 	{
 		if (his->pos == his->realpos + 1)
-			return 0;
+			return NULL;
 	}
 
 	next = HISTORY_SIZE - 1;
@@ -117,5 +117,5 @@ history_up (struct history *his, char *current_text)
 		return his->lines[his->pos];
 	}
 
-	return 0;
+	return NULL;
 }