As I was creating the design document, I noticed a few things around the code that could be cleaned up and made faster. This PR:
Switches to using a keyexpression slice for creating keyexpressions. That way, we don't have to copy a string just to remove the final '/'.
Makes sure that graph_sub_data_handler drops the keyexpression on all paths. In particular, on error paths we would forget to drop the keyexpression, so just use a make_scope_exit.
Remove another unnecessary comment that has to do with porting to zenoh-pico.
Remove an unnecessary use of malloc/memcpy/free when creating a map to use as an attachment for service calls. Since z_bytes_map_insert_by_copy will do a copy anyway, just pass in the array.
When doing rmw_destroy_service, call z_undeclare_queryable to drop the queryable. I believe that this is functionally equivalent to z_drop, but I also think it is more self-documenting to use z_undeclare_queryable here.
As I was creating the design document, I noticed a few things around the code that could be cleaned up and made faster. This PR:
make_scope_exit
.z_bytes_map_insert_by_copy
will do a copy anyway, just pass in the array.rmw_destroy_service
, callz_undeclare_queryable
to drop the queryable. I believe that this is functionally equivalent toz_drop
, but I also think it is more self-documenting to usez_undeclare_queryable
here.