GNOME Bugzilla – Bug 753999
De-duplicate GridElement creation
Last modified: 2015-08-25 23:01:13 UTC
Created attachment 309898 [details] [review] De-duplicate GridElement creation Minor code cleanup.
Review of attachment 309898 [details] [review]: Thanks for cleaning this up and for working to implement Allan's design! ::: src/disks/gduvolumegrid.c @@ +71,3 @@ + * - GridElement.size_ratio is set to 1 + * - All other fields are zeroed + */ The comment is accurate, but also useless: everything you say there is clear from just glancing at the code. You can simply remove it. @@ +73,3 @@ + */ +static GridElement * +grid_element_new (const GduVolumeGridElementType type) Ah, you must be coming from C++. :) There using const in parameter lists is very useful for pass-by-reference parameters. There's no value in using it on pass-by-value parameters, though: consider that whether a pass-by-value parameter is modified is just an implementation detail of the function, and there's no reason for that to be exposed in the function signature. There is only one place we generally use const: for character strings, to indicate whether ownership is transferred. You have to free a "char *" parameter, but not a "const char *".
Created attachment 309900 [details] [review] Updated patch to remove comment and const keyword
Comment on attachment 309900 [details] [review] Updated patch to remove comment and const keyword Looks good, thanks!
I'm unexpectedly touching this code now so let's push this now