]> git.vpit.fr Git - perl/modules/indirect.git/commitdiff
Get rid of indirect_is_indirect
authorVincent Pit <vince@profvince.com>
Mon, 23 Aug 2010 10:39:22 +0000 (12:39 +0200)
committerVincent Pit <vince@profvince.com>
Mon, 23 Aug 2010 10:39:22 +0000 (12:39 +0200)
Its check is redundant and not decisive at all.

indirect.xs

index 9a2b6c06ca9d3305d0c579b29f4e1315ab2d62f5..dedc58bb453c9003a10980dc27dda2a774dde32a 100644 (file)
@@ -700,16 +700,6 @@ done:
 
 /* ... ck_entersub ......................................................... */
 
-STATIC int indirect_is_indirect(const indirect_op_info_t *moi, const indirect_op_info_t *ooi) {
- if (moi->pos > ooi->pos)
-  return 0;
-
- if (moi->pos == ooi->pos)
-  return moi->len == ooi->len && !memcmp(moi->buf, ooi->buf, moi->len);
-
- return 1;
-}
-
 STATIC OP *(*indirect_old_ck_entersub)(pTHX_ OP *) = 0;
 
 STATIC OP *indirect_ck_entersub(pTHX_ OP *o) {
@@ -759,7 +749,10 @@ STATIC OP *indirect_ck_entersub(pTHX_ OP *o) {
   if (!ooi)
    goto done;
 
-  if (indirect_is_indirect(moi, ooi)) {
+  /* When positions are identical, the method and the object must have the
+   * same name. But it also means that it is an indirect call, as "foo->foo"
+   * results in different positions. */
+  if (moi->pos <= ooi->pos) {
    SV *file;
    dSP;