diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-20 18:45:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2008-06-20 18:45:35 +0000 |
commit | 3128de3f19e18c67626ba34523f6696b584c3f9e (patch) | |
tree | a00d8f203122e22528fb8c6f2291a6c32d0ea974 /paste.c | |
parent | ef1c1d57531bbfd762434524fd8e774cf5b9a140 (diff) | |
download | rtmux-3128de3f19e18c67626ba34523f6696b584c3f9e.tar.gz rtmux-3128de3f19e18c67626ba34523f6696b584c3f9e.tar.bz2 rtmux-3128de3f19e18c67626ba34523f6696b584c3f9e.zip |
buffer-limit option.
Diffstat (limited to 'paste.c')
-rw-r--r-- | paste.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -1,4 +1,4 @@ -/* $Id: paste.c,v 1.2 2008-06-20 17:31:48 nicm Exp $ */ +/* $Id: paste.c,v 1.3 2008-06-20 18:45:35 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -97,10 +97,13 @@ paste_free_index(struct paste_stack *ps, u_int idx) } void -paste_add(struct paste_stack *ps, const char *data) +paste_add(struct paste_stack *ps, const char *data, u_int limit) { struct paste_buffer *pb; + while (ARRAY_LENGTH(ps) >= limit) + ARRAY_TRUNC(ps, 1); + pb = xmalloc(sizeof *pb); ARRAY_INSERT(ps, 0, pb); |