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

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

 



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;
    }

-- 
Michał Lowas-Rzechonek <michal.lowas-rzechonek@xxxxxxxxxxx>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND



[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