Permalink
Browse files

change ringbuffer api name

  • Loading branch information...
1 parent 2e9e76d commit a30fb7ecefb105c990d2c3e40fe663358b9e7617 @cloudwu committed Sep 27, 2012
Showing with 6 additions and 6 deletions.
  1. +4 −4 mread.c
  2. +1 −1 ringbuffer.c
  3. +1 −1 ringbuffer.h
View
@@ -462,7 +462,7 @@ mread_pull(struct mread_pool * self , int size) {
for (;;) {
int bytes = recv(s->fd, buffer, rd, MSG_DONTWAIT);
if (bytes > 0) {
- ringbuffer_resize(rb, blk , bytes);
+ ringbuffer_shrink(rb, blk , bytes);
if (bytes < sz) {
_link_node(rb, self->active, s , blk);
s->status = SOCKET_SUSPEND;
@@ -472,20 +472,20 @@ mread_pull(struct mread_pool * self , int size) {
break;
}
if (bytes == 0) {
- ringbuffer_resize(rb, blk, 0);
+ ringbuffer_shrink(rb, blk, 0);
_close_active(self);
return NULL;
}
if (bytes == -1) {
switch(errno) {
case EWOULDBLOCK:
- ringbuffer_resize(rb, blk, 0);
+ ringbuffer_shrink(rb, blk, 0);
s->status = SOCKET_SUSPEND;
return NULL;
case EINTR:
continue;
default:
- ringbuffer_resize(rb, blk, 0);
+ ringbuffer_shrink(rb, blk, 0);
_close_active(self);
return NULL;
}
View
@@ -133,7 +133,7 @@ ringbuffer_collect(struct ringbuffer * rb) {
}
void
-ringbuffer_resize(struct ringbuffer * rb, struct ringbuffer_block * blk, int size) {
+ringbuffer_shrink(struct ringbuffer * rb, struct ringbuffer_block * blk, int size) {
if (size == 0) {
rb->head = block_offset(rb, blk);
return;
View
@@ -15,7 +15,7 @@ void ringbuffer_delete(struct ringbuffer * rb);
void ringbuffer_link(struct ringbuffer *rb , struct ringbuffer_block * prev, struct ringbuffer_block * next);
struct ringbuffer_block * ringbuffer_alloc(struct ringbuffer * rb, int size);
int ringbuffer_collect(struct ringbuffer * rb);
-void ringbuffer_resize(struct ringbuffer * rb, struct ringbuffer_block * blk, int size);
+void ringbuffer_shrink(struct ringbuffer * rb, struct ringbuffer_block * blk, int size);
void ringbuffer_free(struct ringbuffer * rb, struct ringbuffer_block * blk);
int ringbuffer_data(struct ringbuffer * rb, struct ringbuffer_block * blk, int size, int skip, void **ptr);
void * ringbuffer_copy(struct ringbuffer * rb, struct ringbuffer_block * from, int skip, struct ringbuffer_block * to);

0 comments on commit a30fb7e

Please sign in to comment.