28
28
#define TAKE8_64 (d ) ((uint8_t*)&d)[7]
29
29
#endif
30
30
31
- #ifndef msgpack_pack_inline_func
32
- #error msgpack_pack_inline_func template is not defined
33
- #endif
34
-
35
- #ifndef msgpack_pack_user
36
- #error msgpack_pack_user type is not defined
37
- #endif
38
-
39
31
#ifndef msgpack_pack_append_buffer
40
32
#error msgpack_pack_append_buffer callback is not defined
41
33
#endif
@@ -272,110 +264,50 @@ do { \
272
264
} while (0 )
273
265
274
266
275
- #ifdef msgpack_pack_inline_func_fixint
276
-
277
- msgpack_pack_inline_func_fixint (_uint8 )(msgpack_pack_user x , uint8_t d )
278
- {
279
- unsigned char buf [2 ] = {0xcc , TAKE8_8 (d )};
280
- msgpack_pack_append_buffer (x , buf , 2 );
281
- }
282
-
283
- msgpack_pack_inline_func_fixint (_uint16 )(msgpack_pack_user x , uint16_t d )
284
- {
285
- unsigned char buf [3 ];
286
- buf [0 ] = 0xcd ; _msgpack_store16 (& buf [1 ], d );
287
- msgpack_pack_append_buffer (x , buf , 3 );
288
- }
289
-
290
- msgpack_pack_inline_func_fixint (_uint32 )(msgpack_pack_user x , uint32_t d )
291
- {
292
- unsigned char buf [5 ];
293
- buf [0 ] = 0xce ; _msgpack_store32 (& buf [1 ], d );
294
- msgpack_pack_append_buffer (x , buf , 5 );
295
- }
296
-
297
- msgpack_pack_inline_func_fixint (_uint64 )(msgpack_pack_user x , uint64_t d )
298
- {
299
- unsigned char buf [9 ];
300
- buf [0 ] = 0xcf ; _msgpack_store64 (& buf [1 ], d );
301
- msgpack_pack_append_buffer (x , buf , 9 );
302
- }
303
-
304
- msgpack_pack_inline_func_fixint (_int8 )(msgpack_pack_user x , int8_t d )
305
- {
306
- unsigned char buf [2 ] = {0xd0 , TAKE8_8 (d )};
307
- msgpack_pack_append_buffer (x , buf , 2 );
308
- }
309
-
310
- msgpack_pack_inline_func_fixint (_int16 )(msgpack_pack_user x , int16_t d )
311
- {
312
- unsigned char buf [3 ];
313
- buf [0 ] = 0xd1 ; _msgpack_store16 (& buf [1 ], d );
314
- msgpack_pack_append_buffer (x , buf , 3 );
315
- }
316
-
317
- msgpack_pack_inline_func_fixint (_int32 )(msgpack_pack_user x , int32_t d )
318
- {
319
- unsigned char buf [5 ];
320
- buf [0 ] = 0xd2 ; _msgpack_store32 (& buf [1 ], d );
321
- msgpack_pack_append_buffer (x , buf , 5 );
322
- }
323
-
324
- msgpack_pack_inline_func_fixint (_int64 )(msgpack_pack_user x , int64_t d )
325
- {
326
- unsigned char buf [9 ];
327
- buf [0 ] = 0xd3 ; _msgpack_store64 (& buf [1 ], d );
328
- msgpack_pack_append_buffer (x , buf , 9 );
329
- }
330
-
331
- #undef msgpack_pack_inline_func_fixint
332
- #endif
333
-
334
-
335
- msgpack_pack_inline_func (_uint8 )(msgpack_pack_user x , uint8_t d )
267
+ static inline int msgpack_pack_uint8 (msgpack_packer * x , uint8_t d )
336
268
{
337
269
msgpack_pack_real_uint8 (x , d );
338
270
}
339
271
340
- msgpack_pack_inline_func ( _uint16 )( msgpack_pack_user x , uint16_t d )
272
+ static inline int msgpack_pack_uint16 ( msgpack_packer * x , uint16_t d )
341
273
{
342
274
msgpack_pack_real_uint16 (x , d );
343
275
}
344
276
345
- msgpack_pack_inline_func ( _uint32 )( msgpack_pack_user x , uint32_t d )
277
+ static inline int msgpack_pack_uint32 ( msgpack_packer * x , uint32_t d )
346
278
{
347
279
msgpack_pack_real_uint32 (x , d );
348
280
}
349
281
350
- msgpack_pack_inline_func ( _uint64 )( msgpack_pack_user x , uint64_t d )
282
+ static inline int msgpack_pack_uint64 ( msgpack_packer * x , uint64_t d )
351
283
{
352
284
msgpack_pack_real_uint64 (x , d );
353
285
}
354
286
355
- msgpack_pack_inline_func ( _int8 )( msgpack_pack_user x , int8_t d )
287
+ static inline int msgpack_pack_int8 ( msgpack_packer * x , int8_t d )
356
288
{
357
289
msgpack_pack_real_int8 (x , d );
358
290
}
359
291
360
- msgpack_pack_inline_func ( _int16 )( msgpack_pack_user x , int16_t d )
292
+ static inline int msgpack_pack_int16 ( msgpack_packer * x , int16_t d )
361
293
{
362
294
msgpack_pack_real_int16 (x , d );
363
295
}
364
296
365
- msgpack_pack_inline_func ( _int32 )( msgpack_pack_user x , int32_t d )
297
+ static inline int msgpack_pack_int32 ( msgpack_packer * x , int32_t d )
366
298
{
367
299
msgpack_pack_real_int32 (x , d );
368
300
}
369
301
370
- msgpack_pack_inline_func ( _int64 )( msgpack_pack_user x , int64_t d )
302
+ static inline int msgpack_pack_int64 ( msgpack_packer * x , int64_t d )
371
303
{
372
304
msgpack_pack_real_int64 (x , d );
373
305
}
374
306
375
307
376
308
#ifdef msgpack_pack_inline_func_cint
377
309
378
- msgpack_pack_inline_func_cint ( _short )( msgpack_pack_user x , short d )
310
+ static inline int msgpack_pack_short ( msgpack_packer * x , short d )
379
311
{
380
312
#if defined(SIZEOF_SHORT )
381
313
#if SIZEOF_SHORT == 2
@@ -406,7 +338,7 @@ if(sizeof(short) == 2) {
406
338
#endif
407
339
}
408
340
409
- msgpack_pack_inline_func_cint ( _int )( msgpack_pack_user x , int d )
341
+ static inline int msgpack_pack_int ( msgpack_packer * x , int d )
410
342
{
411
343
#if defined(SIZEOF_INT )
412
344
#if SIZEOF_INT == 2
@@ -437,7 +369,7 @@ if(sizeof(int) == 2) {
437
369
#endif
438
370
}
439
371
440
- msgpack_pack_inline_func_cint ( _long )( msgpack_pack_user x , long d )
372
+ static inline int msgpack_pack_long ( msgpack_packer * x , long d )
441
373
{
442
374
#if defined(SIZEOF_LONG )
443
375
#if SIZEOF_LONG == 2
@@ -468,7 +400,7 @@ if(sizeof(long) == 2) {
468
400
#endif
469
401
}
470
402
471
- msgpack_pack_inline_func_cint ( _long_long )( msgpack_pack_user x , long long d )
403
+ static inline int msgpack_pack_long_long ( msgpack_packer * x , long long d )
472
404
{
473
405
#if defined(SIZEOF_LONG_LONG )
474
406
#if SIZEOF_LONG_LONG == 2
@@ -499,7 +431,7 @@ if(sizeof(long long) == 2) {
499
431
#endif
500
432
}
501
433
502
- msgpack_pack_inline_func_cint ( _unsigned_short )( msgpack_pack_user x , unsigned short d )
434
+ static inline int msgpack_pack_unsigned_short ( msgpack_packer * x , unsigned short d )
503
435
{
504
436
#if defined(SIZEOF_SHORT )
505
437
#if SIZEOF_SHORT == 2
@@ -530,7 +462,7 @@ if(sizeof(unsigned short) == 2) {
530
462
#endif
531
463
}
532
464
533
- msgpack_pack_inline_func_cint ( _unsigned_int )( msgpack_pack_user x , unsigned int d )
465
+ static inline int msgpack_pack_unsigned_int ( msgpack_packer * x , unsigned int d )
534
466
{
535
467
#if defined(SIZEOF_INT )
536
468
#if SIZEOF_INT == 2
@@ -561,7 +493,7 @@ if(sizeof(unsigned int) == 2) {
561
493
#endif
562
494
}
563
495
564
- msgpack_pack_inline_func_cint ( _unsigned_long )( msgpack_pack_user x , unsigned long d )
496
+ static inline int msgpack_pack_unsigned_long ( msgpack_packer * x , unsigned long d )
565
497
{
566
498
#if defined(SIZEOF_LONG )
567
499
#if SIZEOF_LONG == 2
@@ -592,7 +524,7 @@ if(sizeof(unsigned long) == 2) {
592
524
#endif
593
525
}
594
526
595
- msgpack_pack_inline_func_cint ( _unsigned_long_long )( msgpack_pack_user x , unsigned long long d )
527
+ static inline int msgpack_pack_unsigned_long_long ( msgpack_packer * x , unsigned long long d )
596
528
{
597
529
#if defined(SIZEOF_LONG_LONG )
598
530
#if SIZEOF_LONG_LONG == 2
@@ -632,7 +564,7 @@ if(sizeof(unsigned long long) == 2) {
632
564
* Float
633
565
*/
634
566
635
- msgpack_pack_inline_func ( _float )( msgpack_pack_user x , float d )
567
+ static inline int msgpack_pack_float ( msgpack_packer * x , float d )
636
568
{
637
569
union { float f ; uint32_t i ; } mem ;
638
570
mem .f = d ;
@@ -641,7 +573,7 @@ msgpack_pack_inline_func(_float)(msgpack_pack_user x, float d)
641
573
msgpack_pack_append_buffer (x , buf , 5 );
642
574
}
643
575
644
- msgpack_pack_inline_func ( _double )( msgpack_pack_user x , double d )
576
+ static inline int msgpack_pack_double ( msgpack_packer * x , double d )
645
577
{
646
578
union { double f ; uint64_t i ; } mem ;
647
579
mem .f = d ;
@@ -660,7 +592,7 @@ msgpack_pack_inline_func(_double)(msgpack_pack_user x, double d)
660
592
* Nil
661
593
*/
662
594
663
- msgpack_pack_inline_func ( _nil )( msgpack_pack_user x )
595
+ static inline int msgpack_pack_nil ( msgpack_packer * x )
664
596
{
665
597
static const unsigned char d = 0xc0 ;
666
598
msgpack_pack_append_buffer (x , & d , 1 );
@@ -671,13 +603,13 @@ msgpack_pack_inline_func(_nil)(msgpack_pack_user x)
671
603
* Boolean
672
604
*/
673
605
674
- msgpack_pack_inline_func ( _true )( msgpack_pack_user x )
606
+ static inline int msgpack_pack_true ( msgpack_packer * x )
675
607
{
676
608
static const unsigned char d = 0xc3 ;
677
609
msgpack_pack_append_buffer (x , & d , 1 );
678
610
}
679
611
680
- msgpack_pack_inline_func ( _false )( msgpack_pack_user x )
612
+ static inline int msgpack_pack_false ( msgpack_packer * x )
681
613
{
682
614
static const unsigned char d = 0xc2 ;
683
615
msgpack_pack_append_buffer (x , & d , 1 );
@@ -688,7 +620,7 @@ msgpack_pack_inline_func(_false)(msgpack_pack_user x)
688
620
* Array
689
621
*/
690
622
691
- msgpack_pack_inline_func ( _array )( msgpack_pack_user x , unsigned int n )
623
+ static inline int msgpack_pack_array ( msgpack_packer * x , unsigned int n )
692
624
{
693
625
if (n < 16 ) {
694
626
unsigned char d = 0x90 | n ;
@@ -709,7 +641,7 @@ msgpack_pack_inline_func(_array)(msgpack_pack_user x, unsigned int n)
709
641
* Map
710
642
*/
711
643
712
- msgpack_pack_inline_func ( _map )( msgpack_pack_user x , unsigned int n )
644
+ static inline int msgpack_pack_map ( msgpack_packer * x , unsigned int n )
713
645
{
714
646
if (n < 16 ) {
715
647
unsigned char d = 0x80 | n ;
@@ -730,7 +662,7 @@ msgpack_pack_inline_func(_map)(msgpack_pack_user x, unsigned int n)
730
662
* Raw
731
663
*/
732
664
733
- msgpack_pack_inline_func ( _raw )( msgpack_pack_user x , size_t l )
665
+ static inline int msgpack_pack_raw ( msgpack_packer * x , size_t l )
734
666
{
735
667
if (l < 32 ) {
736
668
unsigned char d = 0xa0 | (uint8_t )l ;
@@ -746,13 +678,11 @@ msgpack_pack_inline_func(_raw)(msgpack_pack_user x, size_t l)
746
678
}
747
679
}
748
680
749
- msgpack_pack_inline_func ( _raw_body )( msgpack_pack_user x , const void * b , size_t l )
681
+ static inline int msgpack_pack_raw_body ( msgpack_packer * x , const void * b , size_t l )
750
682
{
751
683
msgpack_pack_append_buffer (x , (const unsigned char * )b , l );
752
684
}
753
685
754
- #undef msgpack_pack_inline_func
755
- #undef msgpack_pack_user
756
686
#undef msgpack_pack_append_buffer
757
687
758
688
#undef TAKE8_8
0 commit comments