Simplify magic_size() by knowing that check_new() returns false for NULL.
Nicholas Clark [Wed, 4 May 2011 20:37:24 +0000 (22:37 +0200)]
Size.xs

diff --git a/Size.xs b/Size.xs
index 127152f..8373101 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -312,18 +312,9 @@ cc_opclass(const OP * const o)
    size */
 static void
 magic_size(pTHX_ const SV * const thing, struct state *st) {
-  MAGIC *magic_pointer;
+  MAGIC *magic_pointer = SvMAGIC(thing);
 
-  /* Is there any? */
-  if (!SvMAGIC(thing)) {
-    /* No, bail */
-    return;
-  }
-
-  /* Get the base magic pointer */
-  magic_pointer = SvMAGIC(thing);
-
-  /* Have we seen the magic pointer? */
+  /* Have we seen the magic pointer?  (NULL has always been seen before)  */
   while (check_new(st, magic_pointer)) {
     st->total_size += sizeof(MAGIC);