hzeller / gmrender-resurrect

Resource efficient UPnP/DLNA renderer, optimal for Raspberry Pi, CuBox or a general MediaServer. Fork of GMediaRenderer to add some features to make it usable.
GNU General Public License v2.0
839 stars 204 forks source link

Code improvements to main.c #19

Closed ghost closed 11 years ago

ghost commented 11 years ago

Removed those pesky goto's. This isn't Visual Basic.

Improved creation of return codes.

Made some Informational logging conditional (as it was expected to be).

ghost commented 11 years ago

Hold it. Please, refuse this pull request. I've been doing too much of bash programming lately and I've messed up between bash's true (0) and C's TRUE (1). Do not accept my pull request until I've mended this.

Sorry for my mistake. ;-)

Guzthefuz.

hzeller commented 11 years ago

Thanks for your work. I have some general comments.

I agree, that the 0, -1 return code policy is a bit annoying in gmrender, but if we want to fix it, we need to fix it all the way and have all places that need it, return a boolean. Some intermediate state, in which things are partially done is even more confusing. Note, however, that some places need multiple return codes to give a different return status.

General code style wise: I prefer to have returns without parenthesis, so that they don't look like function calls. So return FALSE; instead of return(FALSE);

ghost commented 11 years ago

I'll work on it. I was too quick in my first pull request. And I hear you concerning coding styles. Gimme some time. I'll adapt. I really want to participate, not to confuse things. ;-)