summaryrefslogtreecommitdiffstats
path: root/commands/edit.c
diff options
context:
space:
mode:
authorSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-27 16:27:20 +0200
committerSascha Hauer <sha@octopus.labnet.pengutronix.de>2007-09-27 16:27:20 +0200
commit6057d62524e0f15d66698e320d35a25cef89e085 (patch)
tree0a0374523c39b4930d2c3a54070150e7f8caacda /commands/edit.c
parent04f2ec02632028e2442a1264c0686ca7fc4890e7 (diff)
downloadbarebox-6057d62524e0f15d66698e320d35a25cef89e085.tar.gz
barebox-6057d62524e0f15d66698e320d35a25cef89e085.tar.xz
learn to realloc
Diffstat (limited to 'commands/edit.c')
-rw-r--r--commands/edit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/commands/edit.c b/commands/edit.c
index c251e9ea59..6f42abc107 100644
--- a/commands/edit.c
+++ b/commands/edit.c
@@ -273,10 +273,11 @@ static int save_file(const char *path)
static void insert_char(char c)
{
int pos = textx;
- char *line = curline->data;
- int end = strlen(line);
+ char *line;
+ int end = strlen(curline->data);
line_realloc(strlen(curline->data) + 2, curline);
+ line = curline->data;
while (end >= pos) {
line[end + 1] = line[end];