Comparison

util-src/ringbuffer.c @ 7941:8067828e7e40

util.ringbuffer: Change types of length related variables to size_t [-Wsign-compare]
author Kim Alvefur <zash@zash.se>
date Thu, 02 Mar 2017 19:22:07 +0100
parent 7889:b8d694646597
child 7969:1c6a07606309
comparison
equal deleted inserted replaced
7940:e520dc0c3af4 7941:8067828e7e40
29 void modpos(ringbuffer *b) { 29 void modpos(ringbuffer *b) {
30 b->rpos = b->rpos % b->alen; 30 b->rpos = b->rpos % b->alen;
31 b->wpos = b->wpos % b->alen; 31 b->wpos = b->wpos % b->alen;
32 } 32 }
33 33
34 int find(ringbuffer *b, const char *s, int l) { 34 int find(ringbuffer *b, const char *s, size_t l) {
35 size_t i, j; 35 size_t i, j;
36 int m; 36 int m;
37 37
38 if(b->rpos == b->wpos) { /* empty */ 38 if(b->rpos == b->wpos) { /* empty */
39 return 0; 39 return 0;
72 return 0; 72 return 0;
73 } 73 }
74 74
75 int rb_read(lua_State *L) { 75 int rb_read(lua_State *L) {
76 ringbuffer *b = luaL_checkudata(L, 1, "ringbuffer_mt"); 76 ringbuffer *b = luaL_checkudata(L, 1, "ringbuffer_mt");
77 int r = luaL_checkinteger(L, 2); 77 size_t r = luaL_checkinteger(L, 2);
78 int peek = lua_toboolean(L, 3); 78 int peek = lua_toboolean(L, 3);
79 79
80 if(r > b->blen) { 80 if(r > b->blen) {
81 lua_pushnil(L); 81 lua_pushnil(L);
82 return 1; 82 return 1;