* (insert_char): Use g_realloc() instead of g_malloc()+strcpy()+g_free().

This commit is contained in:
Andrew V. Samoilov 2004-03-07 07:29:12 +00:00
parent cbedfdbf08
commit 49bcfac068
1 changed files with 1 additions and 5 deletions

View File

@ -1119,14 +1119,10 @@ insert_char (WInput *in, int c_code)
in->need_push = 1;
if (strlen (in->buffer)+1 == in->current_max_len){
/* Expand the buffer */
char *narea = g_malloc (in->current_max_len + in->field_len);
char *narea = g_realloc (in->buffer, in->current_max_len + in->field_len);
if (narea){
char *p = in->buffer;
strcpy (narea, in->buffer);
in->buffer = narea;
in->current_max_len += in->field_len;
g_free (p);
}
}
if (strlen (in->buffer)+1 < in->current_max_len){