9
0
Fork 0

learn to realloc

This commit is contained in:
Sascha Hauer 2007-09-27 16:27:20 +02:00
parent 04f2ec0263
commit 6057d62524
1 changed files with 3 additions and 2 deletions

View File

@ -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];