Skip to content

Commit 9315dba

Browse files
committed
fix: updating exposed types
1 parent 827c321 commit 9315dba

File tree

6 files changed

+60
-55
lines changed

6 files changed

+60
-55
lines changed

include/zenoh-pico/api/macros.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,15 @@ inline bool z_check(const z_owned_hello_t& v) { return z_hello_check(&v); }
351351
inline bool z_check(const z_owned_str_t& v) { return z_str_check(&v); }
352352
inline bool z_check(const z_owned_str_t& v) { return z_sample_check(&v); }
353353

354-
inline void z_call(const z_owned_closure_sample_t &closure, const z_sample_t *sample)
354+
inline void z_call(const z_owned_closure_sample_t &closure, const z_loaned_sample_t *sample)
355355
{ z_closure_sample_call(&closure, sample); }
356-
inline void z_call(const z_owned_closure_owned_sample_t &closure, const z_sample_t *sample)
356+
inline void z_call(const z_owned_closure_owned_sample_t &closure, const z_owned_sample_t *sample)
357357
{ z_closure_owned_sample_call(&closure, sample); }
358-
inline void z_call(const z_owned_closure_query_t &closure, const z_query_t *query)
358+
inline void z_call(const z_owned_closure_query_t &closure, const z_loaned_query_t *query)
359359
{ z_closure_query_call(&closure, query); }
360-
inline void z_call(const z_owned_closure_owned_query_t &closure, const z_query_t *query)
360+
inline void z_call(const z_owned_closure_owned_query_t &closure, const z_owned_query_t *query)
361361
{ z_closure_owned_query_call(&closure, query); }
362-
inline void z_call(const z_owned_closure_reply_t &closure, const z_reply_t *reply)
362+
inline void z_call(const z_owned_closure_reply_t &closure, const z_loaned_reply_t *reply)
363363
{ z_closure_reply_call(&closure, reply); }
364364
inline void z_call(const z_owned_closure_owned_reply_t &closure, z_owned_reply_t *reply)
365365
{ z_closure_owned_reply_call(&closure, reply); }

include/zenoh-pico/api/primitives.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ const z_loaned_keyexpr_t *z_query_keyexpr(const z_loaned_query_t *query);
584584
* Returns:
585585
* Returns a new sample closure.
586586
*/
587-
int8_t z_closure_sample(z_owned_closure_sample_t *closure, _z_data_handler_t call, _z_dropper_handler_t drop,
587+
int8_t z_closure_sample(z_owned_closure_sample_t *closure, z_data_handler_t call, z_dropper_handler_t drop,
588588
void *context);
589589

590590
/**
@@ -608,8 +608,8 @@ int8_t z_closure_sample(z_owned_closure_sample_t *closure, _z_data_handler_t cal
608608
* Returns:
609609
* Returns a new sample closure.
610610
*/
611-
int8_t z_closure_owned_sample(z_owned_closure_owned_sample_t *closure, _z_owned_sample_handler_t call,
612-
_z_dropper_handler_t drop, void *context);
611+
int8_t z_closure_owned_sample(z_owned_closure_owned_sample_t *closure, z_owned_sample_handler_t call,
612+
z_dropper_handler_t drop, void *context);
613613

614614
/**
615615
* Return a new query closure.
@@ -636,7 +636,7 @@ int8_t z_closure_owned_sample(z_owned_closure_owned_sample_t *closure, _z_owned_
636636
* Returns:
637637
* Returns a new query closure.
638638
*/
639-
int8_t z_closure_query(z_owned_closure_query_t *closure, _z_queryable_handler_t call, _z_dropper_handler_t drop,
639+
int8_t z_closure_query(z_owned_closure_query_t *closure, z_queryable_handler_t call, z_dropper_handler_t drop,
640640
void *context);
641641

642642
/**
@@ -660,8 +660,8 @@ int8_t z_closure_query(z_owned_closure_query_t *closure, _z_queryable_handler_t
660660
* Returns:
661661
* Returns a new query closure.
662662
*/
663-
int8_t z_closure_owned_query(z_owned_closure_owned_query_t *closure, _z_owned_query_handler_t call,
664-
_z_dropper_handler_t drop, void *context);
663+
int8_t z_closure_owned_query(z_owned_closure_owned_query_t *closure, z_owned_query_handler_t call,
664+
z_dropper_handler_t drop, void *context);
665665

666666
/**
667667
* Return a new reply closure.
@@ -688,7 +688,7 @@ int8_t z_closure_owned_query(z_owned_closure_owned_query_t *closure, _z_owned_qu
688688
* Returns:
689689
* Returns a new reply closure.
690690
*/
691-
int8_t z_closure_reply(z_owned_closure_reply_t *closure, _z_reply_handler_t call, _z_dropper_handler_t drop,
691+
int8_t z_closure_reply(z_owned_closure_reply_t *closure, z_reply_handler_t call, z_dropper_handler_t drop,
692692
void *context);
693693

694694
/**
@@ -717,7 +717,7 @@ int8_t z_closure_reply(z_owned_closure_reply_t *closure, _z_reply_handler_t call
717717
* Returns a new reply closure.
718718
*/
719719
int8_t z_closure_owned_reply(z_owned_closure_owned_reply_t *closure, z_owned_reply_handler_t call,
720-
_z_dropper_handler_t drop, void *context);
720+
z_dropper_handler_t drop, void *context);
721721

722722
/**
723723
* Return a new hello closure.
@@ -744,7 +744,7 @@ int8_t z_closure_owned_reply(z_owned_closure_owned_reply_t *closure, z_owned_rep
744744
* Returns:
745745
* Returns a new hello closure.
746746
*/
747-
int8_t z_closure_hello(z_owned_closure_hello_t *closure, z_owned_hello_handler_t call, _z_dropper_handler_t drop,
747+
int8_t z_closure_hello(z_owned_closure_hello_t *closure, z_owned_hello_handler_t call, z_dropper_handler_t drop,
748748
void *context);
749749

750750
/**
@@ -772,7 +772,7 @@ int8_t z_closure_hello(z_owned_closure_hello_t *closure, z_owned_hello_handler_t
772772
* Returns:
773773
* Returns a new zid closure.
774774
*/
775-
int8_t z_closure_zid(z_owned_closure_zid_t *closure, z_id_handler_t call, _z_dropper_handler_t drop, void *context);
775+
int8_t z_closure_zid(z_owned_closure_zid_t *closure, z_id_handler_t call, z_dropper_handler_t drop, void *context);
776776

777777
/**************** Loans ****************/
778778
#define _OWNED_FUNCTIONS(loanedtype, ownedtype, name) \

include/zenoh-pico/api/types.h

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -480,24 +480,25 @@ _Bool z_str_array_is_empty(const z_str_array_t *a);
480480
_OWNED_TYPE_PTR(z_str_array_t, str_array)
481481
_LOANED_TYPE(z_str_array_t, str_array)
482482

483-
typedef void (*_z_dropper_handler_t)(void *arg);
484-
typedef void (*_z_owned_sample_handler_t)(z_owned_sample_t *sample, void *arg);
483+
typedef void (*z_dropper_handler_t)(void *arg);
484+
typedef void (*z_owned_sample_handler_t)(z_owned_sample_t *sample, void *arg);
485+
typedef _z_data_handler_t z_data_handler_t;
485486

486487
/**
487488
* Represents the sample closure.
488489
*
489490
* A closure is a structure that contains all the elements for stateful, memory-leak-free callbacks.
490491
*
491492
* Members:
492-
* _z_data_handler_t call: `void *call(const struct z_sample_t*, const void *context)` is the callback function.
493-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
493+
* z_data_handler_t call: `void *call(const struct z_sample_t*, const void *context)` is the callback function.
494+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
494495
* void *context: a pointer to an arbitrary state.
495496
*/
496497
// TODO(sashacmc):
497498
typedef struct {
498499
void *context;
499-
_z_data_handler_t call;
500-
_z_dropper_handler_t drop;
500+
z_data_handler_t call;
501+
z_dropper_handler_t drop;
501502
} z_owned_closure_sample_t;
502503

503504
void z_closure_sample_call(const z_owned_closure_sample_t *closure, const z_loaned_sample_t *sample);
@@ -508,20 +509,22 @@ void z_closure_sample_call(const z_owned_closure_sample_t *closure, const z_loan
508509
* A closure is a structure that contains all the elements for stateful, memory-leak-free callbacks.
509510
*
510511
* Members:
511-
* _z_owned_sample_handler_t call: `void *call(const struct z_owned_sample_t*, const void *context)` is the callback
512+
* z_owned_sample_handler_t call: `void *call(const struct z_owned_sample_t*, const void *context)` is the callback
512513
* function.
513-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed. void *context: a
514+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed. void *context: a
514515
* pointer to an arbitrary state.
515516
*/
516517
// TODO(sashacmc):
517518
typedef struct {
518519
void *context;
519-
_z_owned_sample_handler_t call;
520-
_z_dropper_handler_t drop;
520+
z_owned_sample_handler_t call;
521+
z_dropper_handler_t drop;
521522
} z_owned_closure_owned_sample_t;
522523

523524
void z_closure_owned_sample_call(const z_owned_closure_owned_sample_t *closure, z_owned_sample_t *sample);
524525

526+
typedef _z_queryable_handler_t z_queryable_handler_t;
527+
525528
/**
526529
* Represents the query callback closure.
527530
*
@@ -530,58 +533,59 @@ void z_closure_owned_sample_call(const z_owned_closure_owned_sample_t *closure,
530533
* Members:
531534
* _z_queryable_handler_t call: `void (*_z_queryable_handler_t)(z_query_t *query, void *arg)` is the
532535
* callback function.
533-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
536+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
534537
* void *context: a pointer to an arbitrary state.
535538
*/
536539
// TODO(sashacmc):
537540
typedef struct {
538541
void *context;
539-
_z_queryable_handler_t call;
540-
_z_dropper_handler_t drop;
542+
z_queryable_handler_t call;
543+
z_dropper_handler_t drop;
541544
} z_owned_closure_query_t;
542545

543546
void z_closure_query_call(const z_owned_closure_query_t *closure, const z_loaned_query_t *query);
544547

545-
typedef void (*_z_owned_query_handler_t)(z_owned_query_t *query, void *arg);
548+
typedef void (*z_owned_query_handler_t)(z_owned_query_t *query, void *arg);
546549

547550
/**
548551
* Represents the owned query closure.
549552
*
550553
* A closure is a structure that contains all the elements for stateful, memory-leak-free callbacks.
551554
*
552555
* Members:
553-
* _z_owned_query_handler_t call: `void *call(const struct z_owned_query_t*, const void *context)` is the callback
556+
* z_owned_query_handler_t call: `void *call(const struct z_owned_query_t*, const void *context)` is the callback
554557
* function.
555-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed. void *context: a
558+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed. void *context: a
556559
* pointer to an arbitrary state.
557560
*/
558561
// TODO(sashacmc):
559562
typedef struct {
560563
void *context;
561-
_z_owned_query_handler_t call;
562-
_z_dropper_handler_t drop;
564+
z_owned_query_handler_t call;
565+
z_dropper_handler_t drop;
563566
} z_owned_closure_owned_query_t;
564567

565568
void z_closure_owned_query_call(const z_owned_closure_owned_query_t *closure, z_owned_query_t *query);
566569

567570
typedef void (*z_owned_reply_handler_t)(z_owned_reply_t *reply, void *arg);
571+
typedef _z_reply_handler_t z_reply_handler_t;
568572

569573
/**
570574
* Represents the query reply callback closure.
571575
*
572576
* A closure is a structure that contains all the elements for stateful, memory-leak-free callbacks.
573577
*
574578
* Members:
575-
* _z_reply_handler_t call: `void (*_z_reply_handler_t)(_z_reply_t *reply, void *arg)` is the
579+
* z_reply_handler_t call: `void (*_z_reply_handler_t)(_z_reply_t *reply, void *arg)` is the
576580
* callback function.
577-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
581+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
578582
* void *context: a pointer to an arbitrary state.
579583
*/
580584
// TODO(sashacmc):
581585
typedef struct {
582586
void *context;
583-
_z_reply_handler_t call;
584-
_z_dropper_handler_t drop;
587+
z_reply_handler_t call;
588+
z_dropper_handler_t drop;
585589
} z_owned_closure_reply_t;
586590

587591
void z_closure_reply_call(const z_owned_closure_reply_t *closure, const z_loaned_reply_t *reply);
@@ -594,14 +598,14 @@ void z_closure_reply_call(const z_owned_closure_reply_t *closure, const z_loaned
594598
* Members:
595599
* z_owned_reply_handler_t call: `void (*z_owned_reply_handler_t)(const z_owned_reply_t *reply, void *arg)` is the
596600
* callback function.
597-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
601+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
598602
* void *context: a pointer to an arbitrary state.
599603
*/
600604
// TODO(sashacmc):
601605
typedef struct {
602606
void *context;
603607
z_owned_reply_handler_t call;
604-
_z_dropper_handler_t drop;
608+
z_dropper_handler_t drop;
605609
} z_owned_closure_owned_reply_t;
606610

607611
void z_closure_owned_reply_call(const z_owned_closure_owned_reply_t *closure, z_owned_reply_t *reply);
@@ -616,14 +620,14 @@ typedef void (*z_owned_hello_handler_t)(z_owned_hello_t *hello, void *arg);
616620
* Members:
617621
* z_owned_hello_handler_t call: `void (*z_owned_hello_handler_t)(const z_owned_hello_t *hello, void *arg)` is the
618622
* callback function.
619-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
623+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
620624
* void *context: a pointer to an arbitrary state.
621625
*/
622626
// TODO(sashacmc):
623627
typedef struct {
624628
void *context;
625629
z_owned_hello_handler_t call;
626-
_z_dropper_handler_t drop;
630+
z_dropper_handler_t drop;
627631
} z_owned_closure_hello_t;
628632

629633
void z_closure_hello_call(const z_owned_closure_hello_t *closure, z_owned_hello_t *hello);
@@ -637,14 +641,14 @@ typedef void (*z_id_handler_t)(const z_id_t *id, void *arg);
637641
*
638642
* Members:
639643
* z_id_handler_t call: `void (*z_id_handler_t)(const z_id_t *id, void *arg)` is the callback function.
640-
* _z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
644+
* z_dropper_handler_t drop: `void *drop(void*)` allows the callback's state to be freed.
641645
* void *context: a pointer to an arbitrary state.
642646
*/
643647
// TODO(sashacmc):
644648
typedef struct {
645649
void *context;
646650
z_id_handler_t call;
647-
_z_dropper_handler_t drop;
651+
z_dropper_handler_t drop;
648652
} z_owned_closure_zid_t;
649653

650654
void z_closure_zid_call(const z_owned_closure_zid_t *closure, const z_id_t *id);

src/api/api.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,17 @@ OWNED_FUNCTIONS_RC(session)
443443
return _Z_RES_OK; \
444444
}
445445

446-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_sample_t, closure_sample, _z_data_handler_t, _z_dropper_handler_t)
447-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_owned_sample_t, closure_owned_sample, _z_owned_sample_handler_t,
448-
_z_dropper_handler_t)
449-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_query_t, closure_query, _z_queryable_handler_t, _z_dropper_handler_t)
450-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_owned_query_t, closure_owned_query, _z_owned_query_handler_t,
451-
_z_dropper_handler_t)
452-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_reply_t, closure_reply, _z_reply_handler_t, _z_dropper_handler_t)
446+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_sample_t, closure_sample, _z_data_handler_t, z_dropper_handler_t)
447+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_owned_sample_t, closure_owned_sample, z_owned_sample_handler_t,
448+
z_dropper_handler_t)
449+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_query_t, closure_query, _z_queryable_handler_t, z_dropper_handler_t)
450+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_owned_query_t, closure_owned_query, z_owned_query_handler_t,
451+
z_dropper_handler_t)
452+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_reply_t, closure_reply, _z_reply_handler_t, z_dropper_handler_t)
453453
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_owned_reply_t, closure_owned_reply, z_owned_reply_handler_t,
454-
_z_dropper_handler_t)
455-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_hello_t, closure_hello, z_owned_hello_handler_t, _z_dropper_handler_t)
456-
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_zid_t, closure_zid, z_id_handler_t, _z_dropper_handler_t)
454+
z_dropper_handler_t)
455+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_hello_t, closure_hello, z_owned_hello_handler_t, z_dropper_handler_t)
456+
OWNED_FUNCTIONS_CLOSURE(z_owned_closure_zid_t, closure_zid, z_id_handler_t, z_dropper_handler_t)
457457

458458
/************* Primitives **************/
459459
typedef struct __z_hello_handler_wrapper_t {
@@ -807,7 +807,7 @@ void z_get_options_default(z_get_options_t *options) {
807807
options->timeout_ms = Z_GET_TIMEOUT_DEFAULT;
808808
}
809809

810-
int8_t z_get(const z_loaned_session_t *zs, z_loaned_keyexpr_t *keyexpr, const char *parameters,
810+
int8_t z_get(const z_loaned_session_t *zs, const z_loaned_keyexpr_t *keyexpr, const char *parameters,
811811
z_owned_closure_reply_t *callback, const z_get_options_t *options) {
812812
int8_t ret = _Z_RES_OK;
813813

src/net/reply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
_z_reply_t _z_reply_null(void) {
2121
_z_reply_t r = {._tag = Z_REPLY_TAG_DATA,
2222
.data = {
23-
.replier_id = 0,
23+
.replier_id = {.id = {0}},
2424
.sample = {.in = NULL},
2525
}};
2626
return r;

tests/z_perf_rx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ int main(int argc, char **argv) {
124124
}
125125
#else
126126
int main(void) {
127+
(void)test_stats;
127128
printf("ERROR: Zenoh pico was compiled without Z_FEATURE_SUBSCRIPTION but this test requires it.\n");
128129
return -2;
129130
}

0 commit comments

Comments
 (0)