Strange memory allocation in grok_numeric_radix

--Apple-Mail=_FEB018D1-CB72-4ABA-AE87-532627FE73BB
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii

Calling memEQ shouldn't cause PL_numeric_radix_sv to be reallocated,
so why copy it?


--Apple-Mail=_FEB018D1-CB72-4ABA-AE87-532627FE73BB
Content-Disposition: attachment;
	filename=0001-micro-optimization-less-memory-allocation-in-grok_nu.patch
Content-Type: application/octet-stream;
	x-unix-mode=0600;
	name="0001-micro-optimization-less-memory-allocation-in-grok_nu.patch"
Content-Transfer-Encoding: quoted-printable

=46rom=20ff460c3c57643d027025667e5b3edd1824fee5a6=20Mon=20Sep=2017=20=
00:00:00=202001=0AFrom:=20Bo=20Lindbergh=20<blgl@stacken.kth.se>=0ADate:=20=
Wed,=207=20Oct=202020=2011:49:57=20+0200=0ASubject:=20[PATCH]=20=
micro-optimization:=20less=20memory=20allocation=20in=0A=20=
grok_numeric_radix.=0A=0A---=0A=20numeric.c=20|=206=20+-----=0A=201=20=
file=20changed,=201=20insertion(+),=205=20deletions(-)=0A=0Adiff=20--git=20=
a/numeric.c=20b/numeric.c=0Aindex=205fb7623136..b041913006=20100644=0A=
---=20a/numeric.c=0A+++=20b/numeric.c=0A@@=20-680,15=20+680,11=20@@=20=
Perl_grok_numeric_radix(pTHX_=20const=20char=20**sp,=20const=20char=20=
*send)=0A=20=20=20=20=20=20=20=20=20=
STORE_LC_NUMERIC_FORCE_TO_UNDERLYING();=0A=20=0A=20=20=20=20=20=20=20=20=20=
radix=20=3D=20SvPV(PL_numeric_radix_sv,=20len);=0A-=20=20=20=20=20=20=20=20=
radix=20=3D=20savepvn(radix,=20len);=0A-=0A-=20=20=20=20=20=20=20=20=
RESTORE_LC_NUMERIC();=0A-=0A=20=20=20=20=20=20=20=20=20if=20(*sp=20+=20=
len=20<=3D=20send)=20{=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=
matches_radix=20=3D=20memEQ(*sp,=20radix,=20len);=0A=20=20=20=20=20=20=20=
=20=20}=0A=20=0A-=20=20=20=20=20=20=20=20Safefree(radix);=0A+=20=20=20=20=
=20=20=20=20RESTORE_LC_NUMERIC();=0A=20=0A=20=20=20=20=20=20=20=20=20if=20=
(matches_radix)=20{=0A=20=20=20=20=20=20=20=20=20=20=20=20=20*sp=20+=3D=20=
len;=0A--=20=0A2.24.3=20(Apple=20Git-128)=0A=0A=

--Apple-Mail=_FEB018D1-CB72-4ABA-AE87-532627FE73BB--
0
blgl
10/7/2020 11:25:37 AM
perl.perl5.porters 48233 articles. 1 followers. Follow

0 Replies
11 Views

Similar Articles

[PageSpeed] 21

Reply: