develooper Front page | perl.perl5.changes | Postings from November 2022

[Perl/perl5] 26461d: op.c - add support for empty RCPV strings.

From:
Yves Orton via perl5-changes
Date:
November 23, 2022 09:09
Subject:
[Perl/perl5] 26461d: op.c - add support for empty RCPV strings.
Message ID:
Perl/perl5/push/refs/heads/yves/fix_empty_cop_file_20535/6cbd57-634f9a@github.com
  Branch: refs/heads/yves/fix_empty_cop_file_20535
  Home:   https://github.com/Perl/perl5
  Commit: 26461d5e3ea8d371aa90631751f81dbd5a340567
      https://github.com/Perl/perl5/commit/26461d5e3ea8d371aa90631751f81dbd5a340567
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-11-23 (Wed, 23 Nov 2022)

  Changed paths:
    M cop.h
    M op.c

  Log Message:
  -----------
  op.c - add support for empty RCPV strings.

Currently we have no need for an empty shared string, but there is no
reason it should not be possible. This patch reworks the internals so it
is possible to create one without triggering asserts. Currently we don't
use this, but it seems reasonable that someone might want it in the
future. Under DEBUGGING we will still assert if someone tries to create
an empty RCPV unless the flag specifies it should be allowed.

At the same time the docs for rcpv_new() have been cleaned up a bit to
be more correct and reflect what actually happens inside.

This changes things so that the len member of the RCPV structure is
always non-zero in a well formed structure by accounting for the null
we add to the end explicitly. The RCPV_LEN() macro continues to return
the old value (not including the null).


  Commit: 634f9acb711693e7fb8568b85ad70557551b7f7b
      https://github.com/Perl/perl5/commit/634f9acb711693e7fb8568b85ad70557551b7f7b
  Author: Yves Orton <demerphq@gmail.com>
  Date:   2022-11-23 (Wed, 23 Nov 2022)

  Changed paths:
    M util.c

  Log Message:
  -----------
  util.c - clarify unusual use of rcpv_new()


Compare: https://github.com/Perl/perl5/compare/6cbd57224e69...634f9acb7116



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