aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd-set-buffer.c11
-rw-r--r--paste.c10
-rw-r--r--tmux.h6
-rw-r--r--window-copy.c3
4 files changed, 15 insertions, 15 deletions
diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c
index dd8f4336..e5584b95 100644
--- a/cmd-set-buffer.c
+++ b/cmd-set-buffer.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-buffer.c,v 1.6 2009-01-19 18:23:40 nicm Exp $ */
+/* $Id: cmd-set-buffer.c,v 1.7 2009-01-25 18:51:28 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -52,12 +52,13 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
limit = options_get_number(&s->options, "buffer-limit");
- if (data->buffer == -1)
- paste_add(&s->buffers, data->arg, limit);
- else if (paste_replace(&s->buffers, data->buffer, data->arg) != 0) {
+ if (data->buffer == -1) {
+ paste_add(&s->buffers, xstrdup(data->arg), limit);
+ return (0);
+ }
+ if (paste_replace(&s->buffers, data->buffer, xstrdup(data->arg)) != 0) {
ctx->error(ctx, "no buffer %d", data->buffer);
return (-1);
}
-
return (0);
}
diff --git a/paste.c b/paste.c
index d3e69eeb..418c5a0c 100644
--- a/paste.c
+++ b/paste.c
@@ -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");
diff --git a/tmux.h b/tmux.h
index a0590fdd..f2bb8c12 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.248 2009-01-23 16:59:14 nicm Exp $ */
+/* $Id: tmux.h,v 1.249 2009-01-25 18:51:28 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -1074,8 +1074,8 @@ struct paste_buffer *paste_get_top(struct paste_stack *);
struct paste_buffer *paste_get_index(struct paste_stack *, u_int);
int paste_free_top(struct paste_stack *);
int paste_free_index(struct paste_stack *, u_int);
-void paste_add(struct paste_stack *, const char *, u_int);
-int paste_replace(struct paste_stack *, u_int, const char *);
+void paste_add(struct paste_stack *, char *, u_int);
+int paste_replace(struct paste_stack *, u_int, char *);
/* clock.c */
void clock_draw(struct screen_write_ctx *, u_int, int);
diff --git a/window-copy.c b/window-copy.c
index 93733b61..186392e8 100644
--- a/window-copy.c
+++ b/window-copy.c
@@ -1,4 +1,4 @@
-/* $Id: window-copy.c,v 1.44 2009-01-23 20:50:58 nicm Exp $ */
+/* $Id: window-copy.c,v 1.45 2009-01-25 18:51:28 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -419,7 +419,6 @@ window_copy_copy_selection(struct window_pane *wp, struct client *c)
/* Add the buffer to the stack. */
limit = options_get_number(&c->session->options, "buffer-limit");
paste_add(&c->session->buffers, buf, limit);
- xfree(buf);
}
void