Skip to content

Commit 6f56345

Browse files
snejredboltz
authored andcommitted
Fixed unused-function warnings
The function bodies in header files should be declared static inline.
1 parent edef040 commit 6f56345

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/msgpack/unpack.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,45 +194,45 @@ bool msgpack_unpacker_flush_zone(msgpack_unpacker* mpac);
194194

195195
bool msgpack_unpacker_expand_buffer(msgpack_unpacker* mpac, size_t size);
196196

197-
bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size)
197+
static inline bool msgpack_unpacker_reserve_buffer(msgpack_unpacker* mpac, size_t size)
198198
{
199199
if(mpac->free >= size) { return true; }
200200
return msgpack_unpacker_expand_buffer(mpac, size);
201201
}
202202

203-
char* msgpack_unpacker_buffer(msgpack_unpacker* mpac)
203+
static inline char* msgpack_unpacker_buffer(msgpack_unpacker* mpac)
204204
{
205205
return mpac->buffer + mpac->used;
206206
}
207207

208-
size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac)
208+
static inline size_t msgpack_unpacker_buffer_capacity(const msgpack_unpacker* mpac)
209209
{
210210
return mpac->free;
211211
}
212212

213-
void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size)
213+
static inline void msgpack_unpacker_buffer_consumed(msgpack_unpacker* mpac, size_t size)
214214
{
215215
mpac->used += size;
216216
mpac->free -= size;
217217
}
218218

219-
size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
219+
static inline size_t msgpack_unpacker_message_size(const msgpack_unpacker* mpac)
220220
{
221221
return mpac->parsed - mpac->off + mpac->used;
222222
}
223223

224-
size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac)
224+
static inline size_t msgpack_unpacker_parsed_size(const msgpack_unpacker* mpac)
225225
{
226226
return mpac->parsed;
227227
}
228228

229229

230-
void msgpack_unpacked_init(msgpack_unpacked* result)
230+
static inline void msgpack_unpacked_init(msgpack_unpacked* result)
231231
{
232232
memset(result, 0, sizeof(msgpack_unpacked));
233233
}
234234

235-
void msgpack_unpacked_destroy(msgpack_unpacked* result)
235+
static inline void msgpack_unpacked_destroy(msgpack_unpacked* result)
236236
{
237237
if(result->zone != NULL) {
238238
msgpack_zone_free(result->zone);
@@ -241,7 +241,7 @@ void msgpack_unpacked_destroy(msgpack_unpacked* result)
241241
}
242242
}
243243

244-
msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result)
244+
static inline msgpack_zone* msgpack_unpacked_release_zone(msgpack_unpacked* result)
245245
{
246246
if(result->zone != NULL) {
247247
msgpack_zone* z = result->zone;

src/msgpack/vrefbuffer.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ void msgpack_vrefbuffer_clear(msgpack_vrefbuffer* vref);
9595
/** @} */
9696

9797

98-
msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size)
98+
static inline msgpack_vrefbuffer* msgpack_vrefbuffer_new(size_t ref_size, size_t chunk_size)
9999
{
100100
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)malloc(sizeof(msgpack_vrefbuffer));
101101
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)
105105
return vbuf;
106106
}
107107

108-
void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf)
108+
static inline void msgpack_vrefbuffer_free(msgpack_vrefbuffer* vbuf)
109109
{
110110
if(vbuf == NULL) { return; }
111111
msgpack_vrefbuffer_destroy(vbuf);
112112
free(vbuf);
113113
}
114114

115-
int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
115+
static inline int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
116116
{
117117
msgpack_vrefbuffer* vbuf = (msgpack_vrefbuffer*)data;
118118

@@ -123,12 +123,12 @@ int msgpack_vrefbuffer_write(void* data, const char* buf, unsigned int len)
123123
}
124124
}
125125

126-
const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffer* vref)
126+
static inline const struct iovec* msgpack_vrefbuffer_vec(const msgpack_vrefbuffer* vref)
127127
{
128128
return vref->array;
129129
}
130130

131-
size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref)
131+
static inline size_t msgpack_vrefbuffer_veclen(const msgpack_vrefbuffer* vref)
132132
{
133133
return vref->tail - vref->array;
134134
}

src/msgpack/zone.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void* msgpack_zone_malloc_no_align(msgpack_zone* zone, size_t size)
103103
return ptr;
104104
}
105105

106-
void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
106+
static inline void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
107107
{
108108
return msgpack_zone_malloc_no_align(zone,
109109
((size)+((MSGPACK_ZONE_ALIGN)-1)) & ~((MSGPACK_ZONE_ALIGN)-1));
@@ -113,7 +113,7 @@ void* msgpack_zone_malloc(msgpack_zone* zone, size_t size)
113113
bool msgpack_zone_push_finalizer_expand(msgpack_zone* zone,
114114
void (*func)(void* data), void* data);
115115

116-
bool msgpack_zone_push_finalizer(msgpack_zone* zone,
116+
static inline bool msgpack_zone_push_finalizer(msgpack_zone* zone,
117117
void (*func)(void* data), void* data)
118118
{
119119
msgpack_zone_finalizer_array* const fa = &zone->finalizer_array;
@@ -131,7 +131,7 @@ bool msgpack_zone_push_finalizer(msgpack_zone* zone,
131131
return true;
132132
}
133133

134-
void msgpack_zone_swap(msgpack_zone* a, msgpack_zone* b)
134+
static inline void msgpack_zone_swap(msgpack_zone* a, msgpack_zone* b)
135135
{
136136
msgpack_zone tmp = *a;
137137
*a = *b;

0 commit comments

Comments
 (0)