buffer.c: use LUASOCKET_PRIVATE

This commit is contained in:
E. Westbrook 2019-02-25 15:57:25 -07:00
parent c0374dd46f
commit b95527e140

View File

@ -2,6 +2,8 @@
* Input/Output interface for Lua programs
* LuaSocket toolkit
\*=========================================================================*/
#include "luasocket.h"
#include "lua.h"
#include "lauxlib.h"
#include "compat.h"
@ -32,7 +34,7 @@ static int sendraw(p_buffer buf, const char *data, size_t count, size_t *sent);
/*-------------------------------------------------------------------------*\
* Initializes module
\*-------------------------------------------------------------------------*/
int buffer_open(lua_State *L) {
LUASOCKET_PRIVATE int buffer_open(lua_State *L) {
(void) L;
return 0;
}
@ -40,7 +42,7 @@ int buffer_open(lua_State *L) {
/*-------------------------------------------------------------------------*\
* Initializes C structure
\*-------------------------------------------------------------------------*/
void buffer_init(p_buffer buf, p_io io, p_timeout tm) {
LUASOCKET_PRIVATE void buffer_init(p_buffer buf, p_io io, p_timeout tm) {
buf->first = buf->last = 0;
buf->io = io;
buf->tm = tm;
@ -51,7 +53,7 @@ void buffer_init(p_buffer buf, p_io io, p_timeout tm) {
/*-------------------------------------------------------------------------*\
* object:getstats() interface
\*-------------------------------------------------------------------------*/
int buffer_meth_getstats(lua_State *L, p_buffer buf) {
LUASOCKET_PRIVATE int buffer_meth_getstats(lua_State *L, p_buffer buf) {
lua_pushnumber(L, (lua_Number) buf->received);
lua_pushnumber(L, (lua_Number) buf->sent);
lua_pushnumber(L, timeout_gettime() - buf->birthday);
@ -61,7 +63,7 @@ int buffer_meth_getstats(lua_State *L, p_buffer buf) {
/*-------------------------------------------------------------------------*\
* object:setstats() interface
\*-------------------------------------------------------------------------*/
int buffer_meth_setstats(lua_State *L, p_buffer buf) {
LUASOCKET_PRIVATE int buffer_meth_setstats(lua_State *L, p_buffer buf) {
buf->received = (long) luaL_optnumber(L, 2, (lua_Number) buf->received);
buf->sent = (long) luaL_optnumber(L, 3, (lua_Number) buf->sent);
if (lua_isnumber(L, 4)) buf->birthday = timeout_gettime() - lua_tonumber(L, 4);
@ -72,7 +74,7 @@ int buffer_meth_setstats(lua_State *L, p_buffer buf) {
/*-------------------------------------------------------------------------*\
* object:send() interface
\*-------------------------------------------------------------------------*/
int buffer_meth_send(lua_State *L, p_buffer buf) {
LUASOCKET_PRIVATE int buffer_meth_send(lua_State *L, p_buffer buf) {
int top = lua_gettop(L);
int err = IO_DONE;
size_t size = 0, sent = 0;
@ -105,7 +107,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) {
/*-------------------------------------------------------------------------*\
* object:receive() interface
\*-------------------------------------------------------------------------*/
int buffer_meth_receive(lua_State *L, p_buffer buf) {
LUASOCKET_PRIVATE int buffer_meth_receive(lua_State *L, p_buffer buf) {
int err = IO_DONE, top = lua_gettop(L);
luaL_Buffer b;
size_t size;
@ -154,7 +156,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) {
/*-------------------------------------------------------------------------*\
* Determines if there is any data in the read buffer
\*-------------------------------------------------------------------------*/
int buffer_isempty(p_buffer buf) {
LUASOCKET_PRIVATE int buffer_isempty(p_buffer buf) {
return buf->first >= buf->last;
}