summaryrefslogtreecommitdiff
path: root/universal.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2016-04-12 11:21:40 -0600
committerKarl Williamson <khw@cpan.org>2016-05-24 10:26:29 -0600
commit79f120c89a6e123770f65fd49893ef0b379cd922 (patch)
treed2af18ebcc3405e8e660c3511ecdb39ca620f471 /universal.c
parentc664130fefeaef47ddc7dcbf7ec1830d04af8ea7 (diff)
downloadperl-79f120c89a6e123770f65fd49893ef0b379cd922.tar.gz
Change calculation of locale collation coefficients
Every time a new collation locale is set, two coefficients are calculated that are used in predicting how much space is needed in the transformation of a string by strxfrm(). The transformed string is roughly linear with the the length of the input string, so we are calcaulating 'm' and 'b' such that transformed_length = m * input_length + b Space is allocated based on this prediction. If it is too small, the strxfrm() will fail, and we will have to increase the allotted amount and try again. It's better to get the prediction right to avoid multiple, expensive strxfrm() calls. Prior to this commit, the calculation was not rigorous, and failed on some platforms that don't have a fully conforming strxfrm(). This commit changes to not panic if a locale has an apparent defective collation, but instead silently change to use C-locale collation. It could be argued that a warning should additionally be raised. This commit fixes [perl #121734].
Diffstat (limited to 'universal.c')
0 files changed, 0 insertions, 0 deletions