develooper Front page | perl.perl5.porters | Postings from October 2011

Summary of changes to UTF8 symbol patches

Thread Next
From:
Father Chrysostomos
Date:
October 9, 2011 17:41
Subject:
Summary of changes to UTF8 symbol patches
Message ID:
9D525023-8F1E-443C-B4E7-4E8A1EA0B3A2@cpan.org
This is a very brief summary of the changes I made to Brian Fraser’s work on UTF8 symbol support when I merged it.

I omitted cosmetic changes like this, for brevity’s sake, and to keep diffs smaller:

-		GV * const gv = gv_fetchmethod(stash, "DESTROY");
+		GV * const gv = gv_fetchmethod_pv_autoload(stash, "DESTROY", TRUE, 0);

In this case, GV_NOADD_MASK already includes SVf_UTF8:

-    if (!(flags & ~GV_NOADD_MASK) && !stash) return NULL;
+    if (!(flags & ~(GV_NOADD_MASK|SVf_UTF8)) && !stash) return NULL;

Many of the new API functions had boolean parameters *and* flags parameters, so I merged them together into a single flags param. For that reason, I omitted the gv_fetchmethod_*_autoload functions, as the gv_fetchmtehod_*_flags versions render them redundant.

I left out the call_method_* patch, for a variety of reasons:
1.  None of the bug fixes use them; that’s not really a reason to omit the functions; it’s a reason why they are not pressing.  If someone wants to rework the patch to resolve the other issues, it can be applied.
2. Mathoms, so I’ve been told, exist for the sake of backporting to maint.  The functions are for binary compatibility.  They usually provide function equivalents for what have become macros.  For patches like this, there is no need for a mathom.
3. Having a function exist only as a mathom will break any mathomless builds.  Some people define that to get a smaller binary.  There must be a macro elsewhere.
4. The patch removes the documentation for call_method from perlapi.pod.
5. Having call_method_sv flatten an SV to pass to call_method_pvn, which then creates an SV out of it seems less that efficient. :-)
6. Since it is one line long, call_method_pvn can be defined as a macro, which will make the perl binary smaller.  In fact, all the new call_method_* functions can be macros.
7. call_method_pvn can’t possibly be right, as it does not pass the UTF8 flag to newSVpvn_flags.

This patch is unnecessary, as S_require_tie_mod is only used with fixed ASCII strings:

From da92c19e2c54a569c27fce986f2e4efcbcf3ca7d Mon Sep 17 00:00:00 2001
From: Brian Fraser <fraserbn@gmail.com>
Date: Thu, 7 Jul 2011 04:45:30 -0300
Subject: [PATCH] gv.c: S_require_tie_mod cleanup.

This patch is problematic, as currently any symbol beginning with EXPORT is except from ‘Used only once’ warnings.  It changes that to apply only to EXPORT* symbols used in core.  Someone may be relying on the blanket exception.

From 56bc9c0e7feb61d07834b2e8e4e5aed956d0c2b0 Mon Sep 17 00:00:00 2001
From: Brian Fraser <fraserbn@gmail.com>
Date: Wed, 20 Jul 2011 12:13:35 +0100
Subject: [PATCH] gv.c: Deciding whenever a GV gets magic should be nul clean.

This patch will not be necessary if gv_fetchpvn_flags is made nul-clean (the previous patch), unless there are parts of it (other than $^OPEN and $^WARNING_BITS, which no-one should be setting directly) that do not deal with magic variable names (I didn’t read the whole thing thoroughly):

From 3a0d232673cbdd9ae09fd1a5e85ce4ffa9acadf7 Mon Sep 17 00:00:00 2001
From: Brian Fraser <fraserbn@gmail.com>
Date: Sun, 24 Jul 2011 22:22:52 +0100
Subject: [PATCH] mg.c: Some initial nul-cleanup. Format-related magic is
 still TODO

For more details about the changes, look at the commits I made on the branch that ends with dfb18285.
Thread Next


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