[Maria-developers] [Merge] lp:~atcurtis/maria/maria-5.1-const.part1 into lp:maria
Hi!
"Antony" == Antony T Curtis <Antony> writes:
Antony> Antony T Curtis has proposed merging lp:~atcurtis/maria/maria-5.1-const.part1 into lp:maria. Antony> Requested reviews: Antony> Maria-captains (maria-captains) Antony> declare all constant structures in strings/* as 'const'. Antony> This is less ambitious than previous request. Thanks for doing this in small steps! Antony> === modified file 'strings/ctype-uca.c' <cut> Antony> @@ -7838,7 +7837,7 @@ Antony> uchar *newlengths; Antony> uint16 **newweights; Antony> const uchar *deflengths= uca_length; Antony> - uint16 **defweights= uca_weight; Antony> + const uint16 *const *defweights= uca_weight; Antony> int rc, i; Antony> int ncontractions= 0; Antony> @@ -7928,11 +7927,11 @@ Antony> for (i= 0; i < 256 ; i++) Antony> { Antony> if (!newweights[i]) Antony> - newweights[i]= defweights[i]; Antony> + ((const uint16**) newweights)[i]= defweights[i]; Antony> } Antony> cs->sort_order= newlengths; Antony> - cs->sort_order_big= newweights; Antony> + cs->sort_order_big= (const uint16**) newweights; Antony> cs->contractions= NULL; Can you explain why the last cast is needed ? Shouldn't you be able to assign a non const variable to a const member without a cast? Otherwise the patch looks good to me and it would be ok to include this in MariaDB 5.2. I assume that the 5.1-const tree doesn't include anything else than this patch ? Regards, Monty
Hi, On Tue, Nov 03, 2009 at 07:35:29PM -0000, Antony T Curtis wrote:
Antony T Curtis has proposed merging lp:~atcurtis/maria/maria-5.1-const into lp:maria.
Requested reviews: Maria-captains (maria-captains)
Makes CHARSET_INFO a const structure. Allows compilers to make better choices.
1. Is there any evidence that there exist compilers that will actually be able to produce binaries that will have statistically meaningful speedup after this change? 2. Alternatively, can you point to a bug which did exist but wouldn't have existed if 'const' was used from start? If the measurements for #1 were not done, I'd request them to be done before this change is pushed. We'll make use of the results of the measurements by either - boasting on the changelog how much MariaDB just became faster, or - refusing subsequent "s/Foo/const Foo/g" patches on the grounds that they don't bring any improvements while make the merges with mainlone more difficult. (this one can be probably put in since it's there already). BR Sergey -- Sergey Petrunia, Software Developer Monty Program AB, http://askmonty.org Blog: http://s.petrunia.net/blog
participants (2)
-
Michael Widenius
-
Sergey Petrunya