Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util organization #28

Closed
Lokaltog opened this issue Mar 4, 2014 · 4 comments
Closed

util organization #28

Lokaltog opened this issue Mar 4, 2014 · 4 comments
Labels

Comments

@Lokaltog
Copy link
Owner

Lokaltog commented Mar 4, 2014

After adding macros and utility functions, I was wondering what's best practice for organizing the util directory. Some of the code rely on standard macros like MIN, MAX, and quite a lot of #defines are being added all over the place (most of it my fault, I apologize for that).

Is it good practice to have e.g. a macros.h and defines.h in the util directory that can be included in wkline.h or something like that?

Also, when adding utility functions, should each function have a separate .c/.h file if the functionality falls under the "general function" category (like the copy_prop function I added earlier today)?

@ricardomv
Copy link
Contributor

nah its going to be a mess if you need to do #include "util/macros.h" in every file you need macros just define them in the .h of the file you need the macro (as i think it is now).
The defines too we already have a long compile time if we add every lib we need in every .c file we have the compilation time will increase exponentially.

@Lokaltog
Copy link
Owner Author

Lokaltog commented Mar 4, 2014

Allright, I'll leave it as it is now then.

Regarding compile time, would it be possible to not include every lib when compiling every C file, I've noticed the compile time starting to get a bit out of hand as I've been adding widgets. It would be nice not having to include libmpdclient in 20 C files that don't actually use libmpdclient. I'm guessing it's possible with autotools, what I'm really asking is if you know whether it's a lot of work implementing and maintaining such a change.

@ricardomv
Copy link
Contributor

i think that if you only put the header of libmpd in one file it wont make much difference. i think the time we are seeing is the time the pre-processor cpp takes to copy the header files, not really compiling

@Lokaltog
Copy link
Owner Author

Lokaltog commented Mar 4, 2014

Roger that, I'll leave things as they are.

@Lokaltog Lokaltog closed this as completed Mar 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants