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
« Back to merge proposal
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