Hi Michal, On Wed, 2019-07-10 at 17:01 +0200, Michał Lowas-Rzechonek wrote: > On 07/10, Michał Lowas-Rzechonek wrote: > > mesh-config.h: > > union mesh_config; > > > > union mesh_config *mesh_config_create_config(void); > > void mesh_config_release_config(union mesh_config *config); > > > > mesh-config-json.c: > > union mesh_config { > > json_object *json > > }; > > > > union mesh_config *mesh_config_create_config(void) > > { > > return (union mesh_config*)json_object_new_object(); > > } > > > > void mesh_config_release_config(union mesh_config *cfg) > > { > > json_object *jnode = (json_object *)cfg; > > > > if (!cfg) > > return; > > > > json_object_put(jnode); > > } > > Or even simpler, since we don't even need to define the mesh_config: > > mesh-config.h > struct mesh_config; > > struct mesh_config *mesh_config_create_config(void); > void mesh_config_release_config(struct mesh_config *config); > > struct mesh_config *mesh_config_create_config(void) > { > return (struct mesh_config*)json_object_new_object(); > } > > void mesh_config_release_config(struct mesh_config *cfg) > { > json_object *jnode = (json_object *)cfg; > } > I agree. Defining structure forward is better. Inga
Attachment:
smime.p7s
Description: S/MIME cryptographic signature