]> git.sur5r.net Git - i3/i3/commitdiff
Use realloc instead of manually reallocating
authorAxel Wagner <mail@merovius.de>
Fri, 17 Sep 2010 00:28:56 +0000 (02:28 +0200)
committerAxel Wagner <mail@merovius.de>
Fri, 17 Sep 2010 00:28:56 +0000 (02:28 +0200)
i3bar/src/child.c

index 97162cb4bacc0125cfaba0b620ac447d1368988d..a4c33bcd311dbca91c61802bf8b8d2ef20878fee 100644 (file)
@@ -61,12 +61,8 @@ void stdin_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) {
         }
         if (n == 0) {
             if (rec == buffer_len) {
-                char *tmp = buffer;
-                buffer = malloc(buffer_len + STDIN_CHUNK_SIZE);
-                memset(buffer, '\0', buffer_len);
-                strncpy(buffer, tmp, buffer_len);
                 buffer_len += STDIN_CHUNK_SIZE;
-                FREE(tmp);
+                buffer = realloc(buffer, buffer_len);
             } else {
                 /* remove trailing newline and finish up */
                 buffer[rec-1] = '\0';