[Perl/perl5] f05784: Cast away const in call to strstr()

[email protected] (Karl Williamson via perl5-changes)
Newsgroups perl.perl5.changes
Message-ID <Perl/perl5/push/refs/heads/blead/[email protected]>
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: f057843754194fd72b49cc8d67c507253803e4f9
      https://github.com/Perl/perl5/commit/f057843754194fd72b49cc8d67c507253803e4f9
  Author: Karl Williamson <[email protected]>
  Date:   2026-03-31 (Tue, 31 Mar 2026)

  Changed paths:
    M util.h

  Log Message:
  -----------
  Cast away const in call to strstr()

A future commit will, for the first time, call strstr with a
    const char *
'haystack parameter.  On my Linux box that doesn't compile because, in
spite of the man page, that parameter is declared merely 'char *'.

Looking at string.h, it appears that it can be const under the right
circumstances.


  Commit: c0262c2781650ca4bfeca935495b82c9ec378973
      https://github.com/Perl/perl5/commit/c0262c2781650ca4bfeca935495b82c9ec378973
  Author: Karl Williamson <[email protected]>
  Date:   2026-03-31 (Tue, 31 Mar 2026)

  Changed paths:
    M regen/embed.pl

  Log Message:
  -----------
  embed.pl: Add mnemonics for visibility flags

This creates some more mnemonics so that, for example, 'AC' is repeated
everywhere for that class of visibility


  Commit: 429d0fe25a8e60b34d1093294a511c50755c649d
      https://github.com/Perl/perl5/commit/429d0fe25a8e60b34d1093294a511c50755c649d
  Author: Karl Williamson <[email protected]>
  Date:   2026-03-31 (Tue, 31 Mar 2026)

  Changed paths:
    M embed.fnc
    M embed.h
    M long_names.c
    M proto.h
    M regen/embed.pl

  Log Message:
  -----------
  embed.pl: Create long name functions for mp-flagged macros

This allows XS code to #undef a short name macro, and still have access
to its functionality via a Perl_foo function.  This would go a long way
to allowing XS code to cope with namespace collisions.

Prior to this commit, macros without a thread context parameter did not
have function fallbacks.

The current catch is that all such macros must be flagged as 'mp'.  It's
trivial to add the 'p' flag to any such macro we want.  Or maybe there
could be a Configure option to add it to all public macros.  But that is
future work.  This lays the foundation for it.

One gotcha it took me a while to realize.  Suppose there's a name space
collision with macro A; so the XS code undefs our 'A' in favor of its
own.  But if another of our macros, say 'B',  calls 'A', it will get the
XS version.  Hopefully there's a parameter mismatch and the code doesn't
compile; and the solution would be to #undef 'B' as well.


  Commit: 1f4f334526e1f12e3a700dc9b63255825da86009
      https://github.com/Perl/perl5/commit/1f4f334526e1f12e3a700dc9b63255825da86009
  Author: Karl Williamson <[email protected]>
  Date:   2026-03-31 (Tue, 31 Mar 2026)

  Changed paths:
    M embed.h
    M long_names.c
    M proto.h
    M regen/embed.pl

  Log Message:
  -----------
  Perl extensions don't necessarily need a long form function

The previous commit creates a function for any macro flagged 'mp' that
is visible outside the core, so that name collisions for the short form
macro name can easily be solved.  This isn't needed for perl core use,
as we will fix any collisions that come up before shipping the product.
But the same is true of extensions to core.  Change so that we extend
the exception to include those.


Compare: https://github.com/Perl/perl5/compare/a7fdbfe06509...1f4f334526e1

To unsubscribe from these emails, change your notification settings at https://github.com/Perl/perl5/settings/notifications
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.