Re: [PATCH BlueZ 4/9] mesh: Generalize mesh-config APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux