[svn:parrot] r44476 - trunk/compilers/imcc

bacek at svn.parrot.org bacek at svn.parrot.org
Thu Feb 25 20:24:08 UTC 2010


Author: bacek
Date: Thu Feb 25 20:24:05 2010
New Revision: 44476
URL: https://trac.parrot.org/parrot/changeset/44476

Log:
Constify some bison/flex strings

Modified:
   trunk/compilers/imcc/imcc.l
   trunk/compilers/imcc/imcc.y
   trunk/compilers/imcc/imclexer.c
   trunk/compilers/imcc/imcparser.c

Modified: trunk/compilers/imcc/imcc.l
==============================================================================
--- trunk/compilers/imcc/imcc.l	Thu Feb 25 20:21:00 2010	(r44475)
+++ trunk/compilers/imcc/imcc.l	Thu Feb 25 20:24:05 2010	(r44476)
@@ -726,7 +726,7 @@
                 "Invalid LABEL outside of macro");
         }
         else {
-            char * const fmt    = "local__%s__%s__$";
+            const char * const fmt    = "local__%s__%s__$";
             const size_t fmtlen = strlen(fmt) - (2 * strlen("%s"));
             const size_t len    = strlen(IMCC_INFO(interp)->cur_macro_name)
                                 + yyleng + fmtlen;

Modified: trunk/compilers/imcc/imcc.y
==============================================================================
--- trunk/compilers/imcc/imcc.y	Thu Feb 25 20:21:00 2010	(r44475)
+++ trunk/compilers/imcc/imcc.y	Thu Feb 25 20:24:05 2010	(r44476)
@@ -1422,7 +1422,7 @@
            if ($3 & VT_UNIQUE_REG)
                $$ = mk_ident_ur(interp, $2, $1);
            else if ($3 & VT_OPT_FLAG && $1 != 'I') {
-               char *type;
+               const char *type;
                switch ($1) {
                     case 'N': type = "num";     break;
                     case 'S': type = "string";  break;

Modified: trunk/compilers/imcc/imclexer.c
==============================================================================
--- trunk/compilers/imcc/imclexer.c	Thu Feb 25 20:21:00 2010	(r44475)
+++ trunk/compilers/imcc/imclexer.c	Thu Feb 25 20:24:05 2010	(r44476)
@@ -3909,7 +3909,7 @@
                 "Invalid LABEL outside of macro");
         }
         else {
-            char * const fmt    = "local__%s__%s__$";
+            const char * const fmt    = "local__%s__%s__$";
             const size_t fmtlen = strlen(fmt) - (2 * strlen("%s"));
             const size_t len    = strlen(IMCC_INFO(interp)->cur_macro_name)
                                 + yyleng + fmtlen;

Modified: trunk/compilers/imcc/imcparser.c
==============================================================================
--- trunk/compilers/imcc/imcparser.c	Thu Feb 25 20:21:00 2010	(r44475)
+++ trunk/compilers/imcc/imcparser.c	Thu Feb 25 20:24:05 2010	(r44476)
@@ -3699,7 +3699,7 @@
            if ((yyvsp[(3) - (3)].t) & VT_UNIQUE_REG)
                (yyval.sr) = mk_ident_ur(interp, (yyvsp[(2) - (3)].s), (yyvsp[(1) - (3)].t));
            else if ((yyvsp[(3) - (3)].t) & VT_OPT_FLAG && (yyvsp[(1) - (3)].t) != 'I') {
-               char *type;
+               const char *type;
                switch ((yyvsp[(1) - (3)].t)) {
                     case 'N': type = "num";     break;
                     case 'S': type = "string";  break;


More information about the parrot-commits mailing list