Closed ghost closed 11 years ago
FYI, I will probably change the upnp_append_variable() function later tonight, so that things can be even simpler (I want it to return a boolean and then essentially have the whole thing just one chained call like return upnp_append_variable(...) && upnp_append_variable(...) && upnp_append_variable(...). So if you're about to change the same thing in other files, hold off till tomorrow.
OK, thanks for sharing your intention. Anyway, I'm not looking in that direction right now.
I was thinking... The code often returns '0' or '-1' for success and failure.
Would it make sense to create an include file, potentially named gmrenderer.h or just renderer.h where I could 'define GMR_SUCCESS 0' and 'define GMR_FAILURE -1' or something close to that?
Should you agree, please let me know your thoughts on the naming.
On 21 June 2013 18:52, Guzoft notifications@github.com wrote:
I was thinking... The code often returns '0' or '-1' for success and failure.
Would it make sense to create an include file, potentially named gmrenderer.h or just renderer.h where I could 'define GMR_SUCCESS 0' and 'define GMR_FAILURE -1' or something close to that?
I think we should even to further and attempt to remove this 0/-1 madness as much as possible :) So, having a look where there are places that really require more than -1 as error code. All the others, we should convert to something that returns a boolean value, i.e. 0 means false and 1 means true (so opposite to now - we need to be careful in the transition). Longer term, that will be easier to deal with. Then we can just return TRUE or FALSE as these constants are already defined; and maybe to a typedef char boolean_t; or something to have the API interfaces tagged appropriately.
What do you think ?
-h
FYI, I now simplified the upnp_append_variable() thing. Which got rid of a couple of gotos as well.
"I think we should even to further and attempt to remove this 0/-1 madness as much as possible :)"
Totally agree. But we'll need to tread lightly.
Pretty simple modifications to remove a few gotos in upnp_connmgr.c