diff options
author | nicm <nicm> | 2015-08-29 09:25:00 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-08-29 09:25:00 +0000 |
commit | b56958500036970023c7a53264331cd10a5bbed2 (patch) | |
tree | 4e919788d8f30a08c048d573449a79e03fc06cc1 /paste.c | |
parent | b9f0571780e7058a70a8cc3b6805b6f1a73061e0 (diff) | |
download | rtmux-b56958500036970023c7a53264331cd10a5bbed2.tar.gz rtmux-b56958500036970023c7a53264331cd10a5bbed2.tar.bz2 rtmux-b56958500036970023c7a53264331cd10a5bbed2.zip |
Move struct paste_buffer out of tmux.h.
Diffstat (limited to 'paste.c')
-rw-r--r-- | paste.c | 34 |
1 files changed, 32 insertions, 2 deletions
@@ -30,6 +30,18 @@ * string! */ +struct paste_buffer { + char *data; + size_t size; + + char *name; + int automatic; + u_int order; + + RB_ENTRY(paste_buffer) name_entry; + RB_ENTRY(paste_buffer) time_entry; +}; + u_int paste_next_index; u_int paste_next_order; u_int paste_num_automatic; @@ -60,6 +72,22 @@ paste_cmp_times(const struct paste_buffer *a, const struct paste_buffer *b) return (0); } +/* Get paste buffer name. */ +const char * +paste_buffer_name(struct paste_buffer *pb) +{ + return (pb->name); +} + +/* Get paste buffer data. */ +const char * +paste_buffer_data(struct paste_buffer *pb, size_t *size) +{ + if (size != NULL) + *size = pb->size; + return (pb->data); +} + /* Walk paste buffers by name. */ struct paste_buffer * paste_walk(struct paste_buffer *pb) @@ -71,13 +99,15 @@ paste_walk(struct paste_buffer *pb) /* Get the most recent automatic buffer. */ struct paste_buffer * -paste_get_top(void) +paste_get_top(const char **name) { struct paste_buffer *pb; pb = RB_MIN(paste_time_tree, &paste_by_time); if (pb == NULL) return (NULL); + if (name != NULL) + *name = pb->name; return (pb); } @@ -87,7 +117,7 @@ paste_free_top(void) { struct paste_buffer *pb; - pb = paste_get_top(); + pb = paste_get_top(NULL); if (pb == NULL) return (-1); return (paste_free_name(pb->name)); |