diff options
| author | Ray Strode <rstrode@redhat.com> | 2008-05-22 17:01:09 -0400 |
|---|---|---|
| committer | Ray Strode <rstrode@redhat.com> | 2008-05-22 17:02:56 -0400 |
| commit | d2b4a3ef73738f5a5a131f630a33e3a0b6e5d6de (patch) | |
| tree | 8d0f76da48e771a2a256301af053c8f5164270ca /src/libply/ply-buffer.c | |
| parent | 21081183a2495c37a85e7b78e7cb73023b20f04f (diff) | |
| download | plymouth-d2b4a3ef73738f5a5a131f630a33e3a0b6e5d6de.tar.gz plymouth-d2b4a3ef73738f5a5a131f630a33e3a0b6e5d6de.tar.xz plymouth-d2b4a3ef73738f5a5a131f630a33e3a0b6e5d6de.zip | |
Add new ply_buffer_remove_bytes_at_end
This function is like ply_buffer_remove_bytes, but it
truncates away the end of the buffer instead of shifting
the contents over the start of the buffer.
Diffstat (limited to 'src/libply/ply-buffer.c')
| -rw-r--r-- | src/libply/ply-buffer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libply/ply-buffer.c b/src/libply/ply-buffer.c index 26f4ea0..3f64aec 100644 --- a/src/libply/ply-buffer.c +++ b/src/libply/ply-buffer.c @@ -85,6 +85,17 @@ ply_buffer_remove_bytes (ply_buffer_t *buffer, } } +void +ply_buffer_remove_bytes_at_end (ply_buffer_t *buffer, + size_t bytes_to_remove) +{ + assert (buffer != NULL); + + bytes_to_remove = MIN (buffer->size, bytes_to_remove); + + buffer->size -= bytes_to_remove; +} + ply_buffer_t * ply_buffer_new (void) { |
