This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
looks_like_bool can be const
authorAndy Lester <andy@petdance.com>
Mon, 13 Mar 2006 09:31:52 +0000 (03:31 -0600)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 14 Mar 2006 08:35:24 +0000 (08:35 +0000)
Message-ID: <20060313153152.GA13254@petdance.com>

p4raw-id: //depot/perl@27492

embed.fnc
op.c
proto.h

index 4503983..719cf5c 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1147,7 +1147,7 @@ s |void   |no_bareword_allowed|NN const OP *o
 sR     |OP*    |no_fh_allowed|NN OP *o
 sR     |OP*    |too_few_arguments|NN OP *o|NN const char* name
 sR     |OP*    |too_many_arguments|NN OP *o|NN const char* name
-s      |bool   |looks_like_bool|NN OP* o
+s      |bool   |looks_like_bool|NN const OP* o
 s      |OP*    |newGIVWHENOP   |NULLOK OP* cond|NN OP *block \
                                |I32 enter_opcode|I32 leave_opcode \
                                |PADOFFSET entertarg
diff --git a/op.c b/op.c
index 9a5dfb1..71d0764 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4607,7 +4607,7 @@ S_newGIVWHENOP(pTHX_ OP *cond, OP *block,
  */
 STATIC
 bool
-S_looks_like_bool(pTHX_ OP *o)
+S_looks_like_bool(pTHX_ const OP *o)
 {
     dVAR;
     switch(o->op_type) {
@@ -4678,7 +4678,7 @@ Perl_newGIVENOP(pTHX_ OP *cond, OP *block, PADOFFSET defsv_off)
 OP *
 Perl_newWHENOP(pTHX_ OP *cond, OP *block)
 {
-    bool cond_llb = (!cond || looks_like_bool(cond));
+    const bool cond_llb = (!cond || looks_like_bool(cond));
     OP *cond_op;
 
     if (cond_llb)
diff --git a/proto.h b/proto.h
index c6c0d2f..fd42b8c 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -3180,7 +3180,7 @@ STATIC OP*        S_too_many_arguments(pTHX_ OP *o, const char* name)
                        __attribute__nonnull__(pTHX_1)
                        __attribute__nonnull__(pTHX_2);
 
-STATIC bool    S_looks_like_bool(pTHX_ OP* o)
+STATIC bool    S_looks_like_bool(pTHX_ const OP* o)
                        __attribute__nonnull__(pTHX_1);
 
 STATIC OP*     S_newGIVWHENOP(pTHX_ OP* cond, OP *block, I32 enter_opcode, I32 leave_opcode, PADOFFSET entertarg)