@@ -70,7 +70,7 @@ static inline int msgpack_zbuffer_write(void* data, const char* buf, size_t len)
7070static inline bool msgpack_zbuffer_expand (msgpack_zbuffer * zbuf );
7171
7272
73- bool msgpack_zbuffer_init (msgpack_zbuffer * zbuf ,
73+ static inline bool msgpack_zbuffer_init (msgpack_zbuffer * zbuf ,
7474 int level , size_t init_size )
7575{
7676 memset (zbuf , 0 , sizeof (msgpack_zbuffer ));
@@ -82,13 +82,13 @@ bool msgpack_zbuffer_init(msgpack_zbuffer* zbuf,
8282 return true;
8383}
8484
85- void msgpack_zbuffer_destroy (msgpack_zbuffer * zbuf )
85+ static inline void msgpack_zbuffer_destroy (msgpack_zbuffer * zbuf )
8686{
8787 deflateEnd (& zbuf -> stream );
8888 free (zbuf -> data );
8989}
9090
91- msgpack_zbuffer * msgpack_zbuffer_new (int level , size_t init_size )
91+ static inline msgpack_zbuffer * msgpack_zbuffer_new (int level , size_t init_size )
9292{
9393 msgpack_zbuffer * zbuf = (msgpack_zbuffer * )malloc (sizeof (msgpack_zbuffer ));
9494 if (zbuf == NULL ) return NULL ;
@@ -99,14 +99,14 @@ msgpack_zbuffer* msgpack_zbuffer_new(int level, size_t init_size)
9999 return zbuf ;
100100}
101101
102- void msgpack_zbuffer_free (msgpack_zbuffer * zbuf )
102+ static inline void msgpack_zbuffer_free (msgpack_zbuffer * zbuf )
103103{
104104 if (zbuf == NULL ) { return ; }
105105 msgpack_zbuffer_destroy (zbuf );
106106 free (zbuf );
107107}
108108
109- bool msgpack_zbuffer_expand (msgpack_zbuffer * zbuf )
109+ static inline bool msgpack_zbuffer_expand (msgpack_zbuffer * zbuf )
110110{
111111 size_t used = (char * )zbuf -> stream .next_out - zbuf -> data ;
112112 size_t csize = used + zbuf -> stream .avail_out ;
@@ -124,14 +124,14 @@ bool msgpack_zbuffer_expand(msgpack_zbuffer* zbuf)
124124 return true;
125125}
126126
127- int msgpack_zbuffer_write (void * data , const char * buf , size_t len )
127+ static inline int msgpack_zbuffer_write (void * data , const char * buf , size_t len )
128128{
129129 msgpack_zbuffer * zbuf = (msgpack_zbuffer * )data ;
130130
131131 zbuf -> stream .next_in = (Bytef * )buf ;
132132 zbuf -> stream .avail_in = len ;
133133
134- do {
134+ while ( zbuf -> stream . avail_in > 0 ) {
135135 if (zbuf -> stream .avail_out < MSGPACK_ZBUFFER_RESERVE_SIZE ) {
136136 if (!msgpack_zbuffer_expand (zbuf )) {
137137 return -1 ;
@@ -141,12 +141,12 @@ int msgpack_zbuffer_write(void* data, const char* buf, size_t len)
141141 if (deflate (& zbuf -> stream , Z_NO_FLUSH ) != Z_OK ) {
142142 return -1 ;
143143 }
144- } while ( zbuf -> stream . avail_in > 0 );
144+ }
145145
146146 return 0 ;
147147}
148148
149- char * msgpack_zbuffer_flush (msgpack_zbuffer * zbuf )
149+ static inline char * msgpack_zbuffer_flush (msgpack_zbuffer * zbuf )
150150{
151151 while (true) {
152152 switch (deflate (& zbuf -> stream , Z_FINISH )) {
@@ -163,23 +163,23 @@ char* msgpack_zbuffer_flush(msgpack_zbuffer* zbuf)
163163 }
164164}
165165
166- const char * msgpack_zbuffer_data (const msgpack_zbuffer * zbuf )
166+ static inline const char * msgpack_zbuffer_data (const msgpack_zbuffer * zbuf )
167167{
168168 return zbuf -> data ;
169169}
170170
171- size_t msgpack_zbuffer_size (const msgpack_zbuffer * zbuf )
171+ static inline size_t msgpack_zbuffer_size (const msgpack_zbuffer * zbuf )
172172{
173173 return (char * )zbuf -> stream .next_out - zbuf -> data ;
174174}
175175
176- void msgpack_zbuffer_reset_buffer (msgpack_zbuffer * zbuf )
176+ static inline void msgpack_zbuffer_reset_buffer (msgpack_zbuffer * zbuf )
177177{
178178 zbuf -> stream .avail_out += (char * )zbuf -> stream .next_out - zbuf -> data ;
179179 zbuf -> stream .next_out = (Bytef * )zbuf -> data ;
180180}
181181
182- bool msgpack_zbuffer_reset (msgpack_zbuffer * zbuf )
182+ static inline bool msgpack_zbuffer_reset (msgpack_zbuffer * zbuf )
183183{
184184 if (deflateReset (& zbuf -> stream ) != Z_OK ) {
185185 return false;
@@ -188,7 +188,7 @@ bool msgpack_zbuffer_reset(msgpack_zbuffer* zbuf)
188188 return true;
189189}
190190
191- char * msgpack_zbuffer_release_buffer (msgpack_zbuffer * zbuf )
191+ static inline char * msgpack_zbuffer_release_buffer (msgpack_zbuffer * zbuf )
192192{
193193 char * tmp = zbuf -> data ;
194194 zbuf -> data = NULL ;
0 commit comments