changeset 3226:1fddc6f6b891

Updated SubtlextTagFind()
author unexist
date Tue, 10 Jul 2012 15:55:35 +0200
parents 6ba5b8a79dd7
children c470f281a025
files src/subtlext/subtlext.c
diffstat 1 files changed, 16 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/subtlext/subtlext.c	Thu Jun 28 13:58:42 2012 +0200
+++ b/src/subtlext/subtlext.c	Tue Jul 10 15:55:35 2012 +0200
@@ -250,7 +250,20 @@
               tags |= (1L << (FIX2INT(id) + 1));
           }
         break;
-      default: break;
+      case T_ARRAY:
+          {
+            int i;
+            VALUE entry = Qnil;
+
+            /* Collect tags and raise if a tag wasn't found. Empty
+             * arrays reset tags and never enter this loop */
+            for(i = 0; Qnil != (entry = rb_ary_entry(value, i)); ++i)
+              tags |= SubtlextTagFind(entry);
+          }
+        break;
+      default:
+        rb_raise(rb_eArgError, "Unexpected value-type `%s'",
+          rb_obj_classname(value));
     }
 
   /* Check if tags were found */
@@ -270,29 +283,8 @@
   /* Check ruby object */
   rb_check_frozen(self);
 
-  /* Check object type */
-  switch(rb_type(value))
-    {
-      case T_SYMBOL:
-      case T_STRING:
-      case T_OBJECT:
-        data.l[1] |= SubtlextTagFind(value);
-        break;
-      case T_ARRAY:
-          {
-            int i;
-            VALUE entry = Qnil;
-
-            /* Collect tags and raise if a tag wasn't found. Empty
-             * arrays reset tags and never enter this loop */
-            for(i = 0; Qnil != (entry = rb_ary_entry(value, i)); ++i)
-              data.l[1] |= SubtlextTagFind(entry);
-          }
-        break;
-      default:
-        rb_raise(rb_eArgError, "Unexpected value-type `%s'",
-          rb_obj_classname(value));
-    }
+  /* Convert tags to bitmask */
+  data.l[1] |= SubtlextTagFind(value);
 
   /* Get and update tag mask */
   if(0 != action)