summaryrefslogtreecommitdiff
path: root/ext/Hash-Util-FieldHash
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-10-25 20:21:50 +0100
committerNicholas Clark <nick@ccl4.org>2010-10-25 20:22:37 +0100
commitff0c75af8a61dcd9e5fa0e07c8c01e142cadd899 (patch)
tree57063e256de9013603183e017752e9791874eca3 /ext/Hash-Util-FieldHash
parentc45ec086da6989dfc8043818ee7b442c7c8961ac (diff)
downloadperl-ff0c75af8a61dcd9e5fa0e07c8c01e142cadd899.tar.gz
Merge Hash::Util::FieldHash::_test_uvar_{get,set,same} using ALIAS.
On this platform it reduces the object code size by over 1K. Ideally these test functions would not be in the installed code, but I can't see an easy way to avoid this.
Diffstat (limited to 'ext/Hash-Util-FieldHash')
-rw-r--r--ext/Hash-Util-FieldHash/FieldHash.xs41
1 files changed, 7 insertions, 34 deletions
diff --git a/ext/Hash-Util-FieldHash/FieldHash.xs b/ext/Hash-Util-FieldHash/FieldHash.xs
index 60f5a6e506..2c9664660b 100644
--- a/ext/Hash-Util-FieldHash/FieldHash.xs
+++ b/ext/Hash-Util-FieldHash/FieldHash.xs
@@ -445,46 +445,19 @@ PPCODE:
void
_test_uvar_get(SV* svref, SV* countref)
+ALIAS:
+_test_uvar_get = 1
+_test_uvar_set = 2
+_test_uvar_same = 3
CODE:
if (SvROK(svref) && SvROK(countref)) {
counter = SvRV(countref);
sv_setiv(counter, 0);
HUF_add_uvar_magic(
SvRV(svref),
- &HUF_inc_var,
- NULL,
- 0,
- SvRV(countref)
- );
- }
-
-void
-_test_uvar_set(SV* svref, SV* countref)
-CODE:
- if (SvROK(svref) && SvROK(countref)) {
- counter = SvRV(countref);
- sv_setiv(counter, 0);
- HUF_add_uvar_magic(
- SvRV(svref),
- NULL,
- &HUF_inc_var,
- 0,
+ ix & 1 ? &HUF_inc_var : 0,
+ ix & 2 ? &HUF_inc_var : 0,
+ 0,
SvRV(countref)
);
}
-
-void
-_test_uvar_same(SV* svref, SV* countref)
-CODE:
- if (SvROK(svref) && SvROK(countref)) {
- counter = SvRV(countref);
- sv_setiv(counter, 0);
- HUF_add_uvar_magic(
- SvRV(svref),
- &HUF_inc_var,
- &HUF_inc_var,
- 0,
- NULL
- );
- }
-