Re: Re: [evolution-patches] Bounty Hunt patch: Set wallpaper from mailer



> Actually this really isn't a problem, it just returns a pointer (the actual name saved) vs bool.  This implicitly supplies as much info as the bool, plus useful information too, the saved filename.  The ononly difference is you have to save the return, and g_free it - not a big change.  The harder part is save_part.

I'm not sure I understand what you're asking. Should the number-appending code be in save_part or in set_background? 

> don't add this whitespace stuff.  i preferred the "name(" function calls, like k&r taught me.  

Okay. The coding style guidelines at developer.ximian.com/projects/evolution/patch_guidelines.html show it with the whitespace, though.

> you really can't do this, it assumes you have an extension, but you could have anything given that the value most likely came from the internet.-> crash if there's no '.' in the name.

No, it works out. strrchr returns NULL if '.' is not found, and g_strdup returns NULL if passed NULL. So if there's no '.', the if(!extension) evaluates to true and extension is set to "". I could be missing something, but it works for me.

> The above can be done in one loop, without having the encompassing if() {}

Maybe I'm misunderstanding you, but removing the if() would result in extension and basename being calculated and then immediately freed when they're not needed, which is kind of a waste. 




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