develooper Front page | perl.perl5.changes | Postings from October 2021

[Perl/perl5] 09cd3e: Eliminate more uses of `XPVHV* xhv;` to cache`(XP...

From:
Nicholas Clark via perl5-changes
Date:
October 12, 2021 06:14
Subject:
[Perl/perl5] 09cd3e: Eliminate more uses of `XPVHV* xhv;` to cache`(XP...
Message ID:
Perl/perl5/push/refs/heads/blead/e43d28-09cd3e@github.com
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: 09cd3e1cbb58c83075231a9d80a523ef3631faee
      https://github.com/Perl/perl5/commit/09cd3e1cbb58c83075231a9d80a523ef3631faee
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2021-10-11 (Mon, 11 Oct 2021)

  Changed paths:
    M hv.c

  Log Message:
  -----------
  Eliminate more uses of `XPVHV* xhv;` to cache `(XPVHV*)SvANY(hv)`

Similar to commit 4b6b6165ecccd54b, Perl_hv_clear() should instead read
HvMAX(hv) into a local variable.

Most other remaining uses no longer saved repeated dereferences, so
eliminate the verbosity and replace the explicit dereference with the normal
macro (and in some cases delete the comment which echos the macro).

In S_hv_free_entries() use HvTOTALKEYS(hv) directly. Whilst this is
potentially performing the deference of SvANY(hv) more than once, the
structure of the code is such that this will only happen on the last
iteration of the loop, or on the unlikely event that the hash contained NULL
values. (Such hashes are not legal in "Perl" space, but XS code can create
them.)





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About