diff options
author | Chilledheart <rwindz0@gmail.com> | 2015-03-10 01:19:15 +0800 |
---|---|---|
committer | Chilledheart <rwindz0@gmail.com> | 2015-03-10 01:20:55 +0800 |
commit | ca767c0d9e314489fd10d7bc3ce406f8e223e70e (patch) | |
tree | adfd7461d03df4da1f927c5dfbfc146ffbf8ad2d /src/core/support | |
parent | d3be281353dcfa4cd3d7c30e68f7e9960455fced (diff) |
Add method grp_slice_buffer_pop to remove the last element for grp_slice_buffer
Diffstat (limited to 'src/core/support')
-rw-r--r-- | src/core/support/slice_buffer.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/support/slice_buffer.c b/src/core/support/slice_buffer.c index 6cd51f925c..b280e4bd02 100644 --- a/src/core/support/slice_buffer.c +++ b/src/core/support/slice_buffer.c @@ -143,6 +143,13 @@ void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *s, size_t n) { } } +void gpr_slice_buffer_pop(gpr_slice_buffer *sb) { + if (sb->count != 0) { + size_t count = --sb->count; + sb->length -= GPR_SLICE_LENGTH(sb->slices[count]); + } +} + void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb) { size_t i; |