mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-26 03:36:50 +01:00
Fixed unused-function warnings
The function bodies in header files should be declared static inline.
This commit is contained in:
parent
edef040688
commit
6f56345dd8
@ -194,45 +194,45 @@ bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac);
|
||||
|
||||
bool msgpack_unpacker_expand_buffer(msgpack_unpacker* mpac, size_t size);
|
||||
|
||||
bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size)
|
||||
static inline bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size)
|
||||
{
|
||||
if(mpac->free >= size) { return true; }
|
||||
return msgpack_unpacker_expand_buffer(mpac, size);
|
||||
}
|
||||
|
||||
char* msgpack_unpacker_buffer(msgpack_unpacker* mpac)
|
||||
static inline char* msgpack_unpacker_buffer(msgpack_unpacker* mpac)
|
||||
{
|
||||
return mpac->buffer + mpac->used;
|
||||
}
|
||||
|
||||
size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac)
|
||||
static inline size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac)
|
||||
{
|
||||
return mpac->free;
|
||||
}
|
||||
|
||||
void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size)
|
||||
static inline void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size)
|
||||
{
|
||||
mpac->used += size;
|
||||
mpac->free -= size;
|
||||
}
|
||||
|
||||
size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
|
||||
static inline size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
|
||||
{
|
||||
return mpac->parsed - mpac->off + mpac->used;
|
||||
}
|
||||
|
||||
size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac)
|
||||
static inline size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac)
|
||||
{
|
||||
return mpac->parsed;
|
||||
}
|
||||
|
||||
|
||||
void msgpack_unpacked_init(msgpack_unpacked* result)
|
||||
static inline void msgpack_unpacked_init(msgpack_unpacked* result)
|
||||
{
|
||||
memset(result, 0, sizeof(msgpack_unpacked));
|
||||
}
|
||||
|
||||
void msgpack_unpacked_destroy(msgpack_unpacked* result)
|
||||
static inline void msgpack_unpacked_destroy(msgpack_unpacked* result)
|
||||
{
|
||||
if(result->zone != NULL) {
|
||||
msgpack_zone_free(result->zone);
|
||||
@ -241,7 +241,7 @@ void msgpack_unpacked_destroy(msgpack_unpacked* result)
|
||||
}
|
||||
}
|
||||
|
||||
msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result)
|
||||
static inline msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result)
|
||||
{
|
||||
if(result->zone != NULL) {
|
||||
msgpack_zone* z = result->zone;
|
||||
|
@ -95,7 +95,7 @@ void msgpack_vrefbuffer_clear(msgpack_vrefbuffer* vref);
|
||||
/** @} */
|
||||
|
||||
|
||||
msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size)
|
||||
static inline msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size)
|
||||
{
|
||||
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)malloc(sizeof(msgpack_vrefbuffer));
|
||||
if(!msgpack_vrefbuffer_init(vbuf, ref_size, chunk_size)) {
|
||||
@ -105,14 +105,14 @@ msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size)
|
||||
return vbuf;
|
||||
}
|
||||
|
||||
void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf)
|
||||
static inline void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf)
|
||||
{
|
||||
if(vbuf == NULL) { return; }
|
||||
msgpack_vrefbuffer_destroy(vbuf);
|
||||
free(vbuf);
|
||||
}
|
||||
|
||||
int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
|
||||
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
|
||||
{
|
||||
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)data;
|
||||
|
||||
@ -123,12 +123,12 @@ int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
|
||||
}
|
||||
}
|
||||
|
||||
const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffer* vref)
|
||||
static inline const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffer* vref)
|
||||
{
|
||||
return vref->array;
|
||||
}
|
||||
|
||||
size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref)
|
||||
static inline size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref)
|
||||
{
|
||||
return vref->tail - vref->array;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ void* msgpack_zone_malloc_no_align(msgpack_zone* zone, size_t size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
|
||||
static inline void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
|
||||
{
|
||||
return msgpack_zone_malloc_no_align(zone,
|
||||
((size)+((MSGPACK_ZONE_ALIGN)-1)) & ~((MSGPACK_ZONE_ALIGN)-1));
|
||||
@ -113,7 +113,7 @@ void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
|
||||
bool msgpack_zone_push_finalizer_expand(msgpack_zone* zone,
|
||||
void (*func)(void* data), void* data);
|
||||
|
||||
bool msgpack_zone_push_finalizer(msgpack_zone* zone,
|
||||
static inline bool msgpack_zone_push_finalizer(msgpack_zone* zone,
|
||||
void (*func)(void* data), void* data)
|
||||
{
|
||||
msgpack_zone_finalizer_array* const fa = &zone->finalizer_array;
|
||||
@ -131,7 +131,7 @@ bool msgpack_zone_push_finalizer(msgpack_zone* zone,
|
||||
return true;
|
||||
}
|
||||
|
||||
void msgpack_zone_swap(msgpack_zone* a, msgpack_zone* b)
|
||||
static inline void msgpack_zone_swap(msgpack_zone* a, msgpack_zone* b)
|
||||
{
|
||||
msgpack_zone tmp = *a;
|
||||
*a = *b;
|
||||
|
Loading…
x
Reference in New Issue
Block a user