Re: [PATCH BlueZ] mesh: Clean up includes

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

 



Hi Inga,

On 06/17, Inga Stotland wrote:
> This adds #include for json-c/json.h in mesh-db.h and removes this
> include from the other files that don't need to reference json-c.

While I agree about removal from cfgmod-server, model and node, I don't
think we should remove the include from storage and move it to mesh-db.

I'd rather see #includes follow https://include-what-you-use.org/
approach, that is:

    (...) for every symbol (type, function variable, or macro) that you
    use in foo.cc, either foo.cc or foo.h should #include a .h file that
    exports the declaration of that symbol.

Moreover, I think headers should only be included as-needed (mostly in
.c files), and headers should contain forward declarations of various
types, to make them opaque.

Such an approach cuts implicit dependencies, making code maintenance
easier: when, for example, someone decides to refactor mesh-db not to
use json_object anymore, they shouldn't need to suddenly deal with
missing declarations in other modules (in this case, storage).

Moreover, each header should be self-sufficient: in order to use API
exposed by a given header, it should be enough to include that header
only. At the moment, this is not the case.

A minor side-effect would be faster builds and less rebuilds when code
is being worked on.

If you agree, I am more than happy to fix this throughout the mesh/
codebase.


regards
-- 
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