diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-01-25 18:51:28 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-01-25 18:51:28 +0000 |
commit | d60ad6f483ddbe8ee2458aaef37b6f38140d63f5 (patch) | |
tree | 560d15228106845d2132b293318b05f07192377b /paste.c | |
parent | 32903241a23b2e1f97e19f33086c0f77fd9aaa90 (diff) | |
download | rtmux-d60ad6f483ddbe8ee2458aaef37b6f38140d63f5.tar.gz rtmux-d60ad6f483ddbe8ee2458aaef37b6f38140d63f5.tar.bz2 rtmux-d60ad6f483ddbe8ee2458aaef37b6f38140d63f5.zip |
Make the caller responsible for allocating memory for the paste buffer data
(needed by the load-buffer command when dealing with big files since it'll
prevent tmux from dying due to memory exhaustion). From nicm.
Diffstat (limited to 'paste.c')
-rw-r--r-- | paste.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: paste.c,v 1.5 2009-01-23 16:19:41 nicm Exp $ */ +/* $Id: paste.c,v 1.6 2009-01-25 18:51:28 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -97,7 +97,7 @@ paste_free_index(struct paste_stack *ps, u_int idx) } void -paste_add(struct paste_stack *ps, const char *data, u_int limit) +paste_add(struct paste_stack *ps, char *data, u_int limit) { struct paste_buffer *pb; @@ -107,13 +107,13 @@ paste_add(struct paste_stack *ps, const char *data, u_int limit) pb = xmalloc(sizeof *pb); ARRAY_INSERT(ps, 0, pb); - pb->data = xstrdup(data); + pb->data = data; if (gettimeofday(&pb->tv, NULL) != 0) fatal("gettimeofday"); } int -paste_replace(struct paste_stack *ps, u_int idx, const char *data) +paste_replace(struct paste_stack *ps, u_int idx, char *data) { struct paste_buffer *pb; @@ -123,7 +123,7 @@ paste_replace(struct paste_stack *ps, u_int idx, const char *data) pb = ARRAY_ITEM(ps, idx); xfree(pb->data); - pb->data = xstrdup(data); + pb->data = data; if (gettimeofday(&pb->tv, NULL) != 0) fatal("gettimeofday"); |