[Moose-commits] r7179 - Class-MOP/trunk
rafl at code2.0beta.co.uk
rafl at code2.0beta.co.uk
Thu Dec 25 10:49:08 GMT 2008
Author: rafl
Date: 2008-12-25 02:49:07 -0800 (Thu, 25 Dec 2008)
New Revision: 7179
Modified:
Class-MOP/trunk/MOP.xs
Log:
Don't require the hash key to be specified twice in case name and the value are the same.
Modified: Class-MOP/trunk/MOP.xs
===================================================================
--- Class-MOP/trunk/MOP.xs 2008-12-24 23:35:39 UTC (rev 7178)
+++ Class-MOP/trunk/MOP.xs 2008-12-25 10:49:07 UTC (rev 7179)
@@ -16,11 +16,13 @@
#define DECLARE_KEY(name) SV *key_##name; U32 hash_##name;
-#define PREHASH_KEY(name, value) do { \
+#define PREHASH_KEY_WITH_VALUE(name, value) do { \
key_##name = newSVpvs(value); \
PERL_HASH(hash_##name, value, sizeof(value) - 1); \
} while (0)
+#define PREHASH_KEY(name) PREHASH_KEY_WITH_VALUE(name, #name)
+
DECLARE_KEY(name);
DECLARE_KEY(package);
DECLARE_KEY(package_name);
@@ -302,14 +304,15 @@
MODULE = Class::MOP PACKAGE = Class::MOP
BOOT:
- PREHASH_KEY(name, "name");
- PREHASH_KEY(body, "body");
- PREHASH_KEY(package, "package");
- PREHASH_KEY(package_name, "package_name");
- PREHASH_KEY(package_cache_flag, "_package_cache_flag");
- PREHASH_KEY(methods, "methods");
- PREHASH_KEY(VERSION, "VERSION");
- PREHASH_KEY(ISA, "ISA");
+ PREHASH_KEY(name);
+ PREHASH_KEY(body);
+ PREHASH_KEY(package);
+ PREHASH_KEY(package_name);
+ PREHASH_KEY(methods);
+ PREHASH_KEY(ISA);
+ PREHASH_KEY_WITH_VALUE(package_cache_flag, "_package_cache_flag");
+ /* we can't stringify VERSION as it's a define already */
+ PREHASH_KEY_WITH_VALUE(VERSION, "VALUE");
method_metaclass = newSVpvs("method_metaclass");
wrap = newSVpvs("wrap");
More information about the Moose-commits
mailing list