1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-02-22 17:57:46 +03:00

a faster mem_collector, tests also updated

This commit is contained in:
Ruben S. Montero 2010-08-10 16:30:54 +02:00
parent 62fd74e890
commit 92c31a5052
12 changed files with 114 additions and 225 deletions

View File

@ -17,7 +17,7 @@
#ifndef MEM_COLLECTOR_H_
#define MEM_COLLECTOR_H_
#define MEM_COLLECTOR_CHUNK 10
#define MEM_COLLECTOR_CHUNK 100
/**
* mem_collector. A simple struct to track strdup'ed strings in lex parsers.
@ -27,6 +27,7 @@ typedef struct mem_collector_
{
char** str_buffer;
int size;
int next;
} mem_collector;
/**
@ -50,11 +51,4 @@ void mem_collector_cleanup(mem_collector * mc);
*/
char * mem_collector_strdup(mem_collector *mc, const char * str);
/**
* Frees a previously strdup'ed string with mem_collector_strdup
* @param mc pointer to the mem_collector
* @param str string to be freed
*/
void mem_collector_free(mem_collector *mc, const char * str);
#endif /*MEM_COLLECTOR_H_*/

View File

@ -85,7 +85,13 @@ TESTS=`find $TWD_DIR -name test -type d | grep -v ruby`
for i in $TESTS ; do
cd $BASE_DIR
echo ; echo
echo "#####################################################################"
echo "#####################################################################"
echo "Doing $i ..."
echo "#####################################################################"
echo "#####################################################################"
echo ; echo
cd $i
if [ "$CLEAR" = "yes" ] ; then
@ -96,7 +102,11 @@ for i in $TESTS ; do
else
for j in `ls test*` ; do
if [ -x $j ] ; then
echo ; echo "---------------------------------------------------------------------"
echo "Test Program: $j"
echo "---------------------------------------------------------------------"
$CALLER ./$j $TEST_ARGS
echo "---------------------------------------------------------------------"
fi
done
fi

View File

@ -28,6 +28,7 @@ void mem_collector_init(mem_collector * mc)
mc->str_buffer = (char **) malloc (sizeof(char*) * MEM_COLLECTOR_CHUNK);
mc->size = MEM_COLLECTOR_CHUNK;
mc->next = 0;
for (i=0; i< mc->size ; i++)
{
@ -48,6 +49,10 @@ void mem_collector_cleanup(mem_collector * mc)
{
free(mc->str_buffer[i]);
}
else /* No str's left in the pool */
{
break;
}
}
free(mc->str_buffer);
@ -58,53 +63,27 @@ void mem_collector_cleanup(mem_collector * mc)
char * mem_collector_strdup(mem_collector *mc, const char * str)
{
int done = 0;
int i, old_size;
char * new_str;
for (i=0; i< mc->size ; i++)
{
if ( mc->str_buffer[i] == 0 )
{
done = 1;
break;
}
}
if (done == 0)
if ( mc->next == mc->size )
{
old_size = mc->size;
mc->size = mc->size + MEM_COLLECTOR_CHUNK;
mc->str_buffer = (char **) realloc(mc->str_buffer,
sizeof(char*) * mc->size);
for ( i = old_size ; i < mc->size ; i++)
{
mc->str_buffer[i] = 0;
}
i = old_size;
}
mc->str_buffer[i] = strdup(str);
new_str = strdup(str);
mc->str_buffer[mc->next++] = new_str;
return mc->str_buffer[i];
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void mem_collector_free(mem_collector *mc, const char * str)
{
int i;
for (i=0; i< mc->size ; i++)
{
if ( mc->str_buffer[i] == str )
{
free(mc->str_buffer[i]);
mc->str_buffer[i] = 0;
break;
}
}
return new_str;
}
/* -------------------------------------------------------------------------- */

View File

@ -1,8 +1,26 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2010, OpenNebula Project Leads (OpenNebula.org) */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
extern "C"
{
#include "mem_collector.h"
}
#include <string.h>
#include <TestFixture.h>
#include <TestAssert.h>
#include <TestSuite.h>
@ -33,29 +51,10 @@ public:
char * st3 = mem_collector_strdup(&mc,"HELLO");
char * st4 = mem_collector_strdup(&mc,"BYE");
mem_collector_free(&mc,st1);
mem_collector_free(&mc,st2);
mem_collector_free(&mc,st3);
mem_collector_free(&mc,st4);
mem_collector_cleanup(&mc);
CPPUNIT_ASSERT(mc.size == MEM_COLLECTOR_CHUNK);
}
void test_not_free()
{
mem_collector mc;
mem_collector_init(&mc);
char * st1 = mem_collector_strdup(&mc,"HOLA");
char * st2 = mem_collector_strdup(&mc,"ADIOS");
char * st3 = mem_collector_strdup(&mc,"HELLO");
char * st4 = mem_collector_strdup(&mc,"BYE");
mem_collector_free(&mc,st2);
mem_collector_free(&mc,st4);
CPPUNIT_ASSERT(strcmp(mc.str_buffer[0],"HOLA")==0);
CPPUNIT_ASSERT(strcmp(mc.str_buffer[1],"ADIOS")==0);
CPPUNIT_ASSERT(strcmp(mc.str_buffer[2],"HELLO")==0);
CPPUNIT_ASSERT(strcmp(mc.str_buffer[3],"BYE")==0);
mem_collector_cleanup(&mc);
@ -67,7 +66,7 @@ public:
mem_collector mc;
int max_size;
max_size = (MEM_COLLECTOR_CHUNK * 3) + 1;
max_size = (MEM_COLLECTOR_CHUNK * 3) + 5;
mem_collector_init(&mc);
@ -76,6 +75,11 @@ public:
mem_collector_strdup(&mc,"HOLA");
}
for (int i=0; i < max_size ; i++)
{
CPPUNIT_ASSERT(strcmp(mc.str_buffer[i],"HOLA")==0);
}
mem_collector_cleanup(&mc);
CPPUNIT_ASSERT(mc.size == MEM_COLLECTOR_CHUNK * 4);
@ -89,10 +93,6 @@ public:
"test_all_free() Test",
&MemCollectorTest::test_all_free));
ts->addTest(new CppUnit::TestCaller<MemCollectorTest>(
"test_not_free() Test",
&MemCollectorTest::test_not_free));
ts->addTest(new CppUnit::TestCaller<MemCollectorTest>(
"test_realloc() Test",
&MemCollectorTest::test_realloc));

View File

@ -493,8 +493,8 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 100, 100, 101, 104, 131, 132, 133, 134, 135,
136, 137, 138
0, 100, 100, 101, 104, 129, 130, 131, 132, 133,
134, 135, 136
};
#endif
@ -1509,71 +1509,69 @@ yyreduce:
}
(yyval.val_float) = val;
mem_collector_free(mc,(yyvsp[(1) - (1)].val_str));
;}
break;
case 5:
/* Line 1464 of yacc.c */
#line 131 "expr_arith.y"
#line 129 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (1)].val_float); ;}
break;
case 6:
/* Line 1464 of yacc.c */
#line 132 "expr_arith.y"
#line 130 "expr_arith.y"
{ (yyval.val_float) = static_cast<float>((yyvsp[(1) - (1)].val_int)); ;}
break;
case 7:
/* Line 1464 of yacc.c */
#line 133 "expr_arith.y"
#line 131 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) + (yyvsp[(3) - (3)].val_float);;}
break;
case 8:
/* Line 1464 of yacc.c */
#line 134 "expr_arith.y"
#line 132 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) - (yyvsp[(3) - (3)].val_float);;}
break;
case 9:
/* Line 1464 of yacc.c */
#line 135 "expr_arith.y"
#line 133 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) * (yyvsp[(3) - (3)].val_float);;}
break;
case 10:
/* Line 1464 of yacc.c */
#line 136 "expr_arith.y"
#line 134 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(1) - (3)].val_float) / (yyvsp[(3) - (3)].val_float);;}
break;
case 11:
/* Line 1464 of yacc.c */
#line 137 "expr_arith.y"
#line 135 "expr_arith.y"
{ (yyval.val_float) = - (yyvsp[(2) - (2)].val_float);;}
break;
case 12:
/* Line 1464 of yacc.c */
#line 138 "expr_arith.y"
#line 136 "expr_arith.y"
{ (yyval.val_float) = (yyvsp[(2) - (3)].val_float);;}
break;
/* Line 1464 of yacc.c */
#line 1577 "expr_arith.cc"
#line 1575 "expr_arith.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1792,7 +1790,7 @@ yyreturn:
/* Line 1684 of yacc.c */
#line 141 "expr_arith.y"
#line 139 "expr_arith.y"
extern "C" void expr_arith__error(

View File

@ -125,8 +125,6 @@ expr: STRING { float val = 0.0;
}
$$ = val;
mem_collector_free(mc,$1);
}
| FLOAT { $$ = $1; }
| INTEGER { $$ = static_cast<float>($1); }

View File

@ -501,8 +501,8 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 103, 103, 104, 107, 114, 121, 128, 135, 142,
149, 156, 163, 171, 179, 180, 181, 182
0, 103, 103, 104, 107, 112, 117, 122, 127, 132,
137, 142, 147, 152, 157, 158, 159, 160
};
#endif
@ -1499,153 +1499,131 @@ yyreduce:
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));;}
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_int);;}
break;
case 5:
/* Line 1464 of yacc.c */
#line 114 "expr_bool.y"
#line 112 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);
mem_collector_free(mc,(yyvsp[(1) - (4)].val_str));;}
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_int);;}
break;
case 6:
/* Line 1464 of yacc.c */
#line 121 "expr_bool.y"
#line 117 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));;}
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_int);;}
break;
case 7:
/* Line 1464 of yacc.c */
#line 128 "expr_bool.y"
#line 122 "expr_bool.y"
{ int val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));;}
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_int);;}
break;
case 8:
/* Line 1464 of yacc.c */
#line 135 "expr_bool.y"
#line 127 "expr_bool.y"
{ float val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_float);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));;}
(yyval.val_int) = val == (yyvsp[(3) - (3)].val_float);;}
break;
case 9:
/* Line 1464 of yacc.c */
#line 142 "expr_bool.y"
#line 132 "expr_bool.y"
{ float val;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_float);
mem_collector_free(mc,(yyvsp[(1) - (4)].val_str));;}
(yyval.val_int) = val != (yyvsp[(4) - (4)].val_float);;}
break;
case 10:
/* Line 1464 of yacc.c */
#line 149 "expr_bool.y"
#line 137 "expr_bool.y"
{float val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_float);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));;}
(yyval.val_int) = val > (yyvsp[(3) - (3)].val_float);;}
break;
case 11:
/* Line 1464 of yacc.c */
#line 156 "expr_bool.y"
#line 142 "expr_bool.y"
{float val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_float);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));;}
(yyval.val_int) = val < (yyvsp[(3) - (3)].val_float);;}
break;
case 12:
/* Line 1464 of yacc.c */
#line 163 "expr_bool.y"
#line 147 "expr_bool.y"
{ string val;
get_xml_attribute(oxml,(yyvsp[(1) - (3)].val_str),val);
(yyval.val_int) = val.empty() ? false :fnmatch((yyvsp[(3) - (3)].val_str), val.c_str(), 0) == 0;
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));
mem_collector_free(mc,(yyvsp[(3) - (3)].val_str));;}
(yyval.val_int) = val.empty() ? false :fnmatch((yyvsp[(3) - (3)].val_str), val.c_str(), 0) == 0;;}
break;
case 13:
/* Line 1464 of yacc.c */
#line 171 "expr_bool.y"
#line 152 "expr_bool.y"
{ string val;
get_xml_attribute(oxml,(yyvsp[(1) - (4)].val_str),val);
(yyval.val_int) = val.empty() ? false : fnmatch((yyvsp[(4) - (4)].val_str), val.c_str(), 0) != 0;
mem_collector_free(mc,(yyvsp[(1) - (4)].val_str));
mem_collector_free(mc,(yyvsp[(4) - (4)].val_str));;}
(yyval.val_int) = val.empty() ? false : fnmatch((yyvsp[(4) - (4)].val_str), val.c_str(), 0) != 0;;}
break;
case 14:
/* Line 1464 of yacc.c */
#line 179 "expr_bool.y"
#line 157 "expr_bool.y"
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) && (yyvsp[(3) - (3)].val_int); ;}
break;
case 15:
/* Line 1464 of yacc.c */
#line 180 "expr_bool.y"
#line 158 "expr_bool.y"
{ (yyval.val_int) = (yyvsp[(1) - (3)].val_int) || (yyvsp[(3) - (3)].val_int); ;}
break;
case 16:
/* Line 1464 of yacc.c */
#line 181 "expr_bool.y"
#line 159 "expr_bool.y"
{ (yyval.val_int) = ! (yyvsp[(2) - (2)].val_int); ;}
break;
case 17:
/* Line 1464 of yacc.c */
#line 182 "expr_bool.y"
#line 160 "expr_bool.y"
{ (yyval.val_int) = (yyvsp[(2) - (3)].val_int); ;}
break;
/* Line 1464 of yacc.c */
#line 1649 "expr_bool.cc"
#line 1627 "expr_bool.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1864,7 +1842,7 @@ yyreturn:
/* Line 1684 of yacc.c */
#line 185 "expr_bool.y"
#line 163 "expr_bool.y"
extern "C" void expr_bool__error(

View File

@ -107,74 +107,52 @@ stmt: expr { result=$1; }
expr: STRING '=' INTEGER { int val;
get_xml_attribute(oxml,$1,val);
$$ = val == $3;
mem_collector_free(mc,$1);}
$$ = val == $3;}
| STRING '!' '=' INTEGER { int val;
get_xml_attribute(oxml,$1,val);
$$ = val != $4;
mem_collector_free(mc,$1);}
$$ = val != $4;}
| STRING '>' INTEGER { int val;
get_xml_attribute(oxml,$1,val);
$$ = val > $3;
mem_collector_free(mc,$1);}
$$ = val > $3;}
| STRING '<' INTEGER { int val;
get_xml_attribute(oxml,$1,val);
$$ = val < $3;
mem_collector_free(mc,$1);}
$$ = val < $3;}
| STRING '=' FLOAT { float val;
get_xml_attribute(oxml,$1,val);
$$ = val == $3;
mem_collector_free(mc,$1);}
$$ = val == $3;}
| STRING '!' '=' FLOAT { float val;
get_xml_attribute(oxml,$1,val);
$$ = val != $4;
mem_collector_free(mc,$1);}
$$ = val != $4;}
| STRING '>' FLOAT {float val;
get_xml_attribute(oxml,$1,val);
$$ = val > $3;
mem_collector_free(mc,$1);}
$$ = val > $3;}
| STRING '<' FLOAT {float val;
get_xml_attribute(oxml,$1,val);
$$ = val < $3;
mem_collector_free(mc,$1);}
$$ = val < $3;}
| STRING '=' STRING { string val;
get_xml_attribute(oxml,$1,val);
$$ = val.empty() ? false :fnmatch($3, val.c_str(), 0) == 0;
mem_collector_free(mc,$1);
mem_collector_free(mc,$3);}
$$ = val.empty() ? false :fnmatch($3, val.c_str(), 0) == 0;}
| STRING '!''=' STRING { string val;
get_xml_attribute(oxml,$1,val);
$$ = val.empty() ? false : fnmatch($4, val.c_str(), 0) != 0;
mem_collector_free(mc,$1);
mem_collector_free(mc,$4);}
$$ = val.empty() ? false : fnmatch($4, val.c_str(), 0) != 0;}
| expr '&' expr { $$ = $1 && $3; }
| expr '|' expr { $$ = $1 || $3; }

View File

@ -492,7 +492,7 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
0, 94, 94, 95, 98, 111, 125, 139, 155
0, 94, 94, 95, 98, 108, 121, 133, 146
};
#endif
@ -1466,16 +1466,13 @@ yyreduce:
pattr = new SingleAttribute(name,unescape(value));
tmpl->set(pattr);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));
mem_collector_free(mc,(yyvsp[(3) - (3)].val_str));
;}
break;
case 5:
/* Line 1464 of yacc.c */
#line 112 "template_syntax.y"
#line 109 "template_syntax.y"
{
Attribute * pattr;
string name((yyvsp[(1) - (5)].val_str));
@ -1487,14 +1484,13 @@ yyreduce:
tmpl->set(pattr);
delete amap;
mem_collector_free(mc,(yyvsp[(1) - (5)].val_str));
;}
break;
case 6:
/* Line 1464 of yacc.c */
#line 126 "template_syntax.y"
#line 122 "template_syntax.y"
{
Attribute * pattr;
string name((yyvsp[(1) - (2)].val_str));
@ -1503,15 +1499,13 @@ yyreduce:
pattr = new SingleAttribute(name,value);
tmpl->set(pattr);
mem_collector_free(mc,(yyvsp[(1) - (2)].val_str));
;}
break;
case 7:
/* Line 1464 of yacc.c */
#line 140 "template_syntax.y"
#line 134 "template_syntax.y"
{
map<string,string>* vattr;
string name((yyvsp[(1) - (3)].val_str));
@ -1523,16 +1517,13 @@ yyreduce:
vattr->insert(make_pair(name,unescape(value)));
(yyval.val_attr) = static_cast<void *>(vattr);
mem_collector_free(mc,(yyvsp[(1) - (3)].val_str));
mem_collector_free(mc,(yyvsp[(3) - (3)].val_str));
;}
break;
case 8:
/* Line 1464 of yacc.c */
#line 156 "template_syntax.y"
#line 147 "template_syntax.y"
{
string name((yyvsp[(3) - (5)].val_str));
string value((yyvsp[(5) - (5)].val_str));
@ -1544,16 +1535,13 @@ yyreduce:
attrmap->insert(make_pair(name,unescape(value)));
(yyval.val_attr) = (yyvsp[(1) - (5)].val_attr);
mem_collector_free(mc,(yyvsp[(3) - (5)].val_str));
mem_collector_free(mc,(yyvsp[(5) - (5)].val_str));
;}
break;
/* Line 1464 of yacc.c */
#line 1557 "template_syntax.cc"
#line 1545 "template_syntax.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1772,7 +1760,7 @@ yyreturn:
/* Line 1684 of yacc.c */
#line 172 "template_syntax.y"
#line 160 "template_syntax.y"
string& unescape (string &str)

View File

@ -104,9 +104,6 @@ attribute: VARIABLE EQUAL STRING
pattr = new SingleAttribute(name,unescape(value));
tmpl->set(pattr);
mem_collector_free(mc,$1);
mem_collector_free(mc,$3);
}
| VARIABLE EQUAL OBRACKET array_val CBRACKET
{
@ -120,7 +117,6 @@ attribute: VARIABLE EQUAL STRING
tmpl->set(pattr);
delete amap;
mem_collector_free(mc,$1);
}
| VARIABLE EQUAL_EMPTY
{
@ -131,8 +127,6 @@ attribute: VARIABLE EQUAL STRING
pattr = new SingleAttribute(name,value);
tmpl->set(pattr);
mem_collector_free(mc,$1);
}
;
@ -148,9 +142,6 @@ array_val: VARIABLE EQUAL STRING
vattr->insert(make_pair(name,unescape(value)));
$$ = static_cast<void *>(vattr);
mem_collector_free(mc,$1);
mem_collector_free(mc,$3);
}
| array_val COMMA VARIABLE EQUAL STRING
{
@ -164,9 +155,6 @@ array_val: VARIABLE EQUAL STRING
attrmap->insert(make_pair(name,unescape(value)));
$$ = $1;
mem_collector_free(mc,$3);
mem_collector_free(mc,$5);
}
;
%%

View File

@ -639,7 +639,7 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 244, 244, 245, 248, 253, 268, 286
0, 244, 244, 245, 248, 252, 265, 280
};
#endif
@ -1615,14 +1615,13 @@ yyreduce:
#line 249 "vm_var_syntax.y"
{
(*parsed) << (yyvsp[(1) - (1)].val_str);
mem_collector_free(mc,(yyvsp[(1) - (1)].val_str));
;}
break;
case 5:
/* Line 1464 of yacc.c */
#line 254 "vm_var_syntax.y"
#line 253 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (2)].val_str));
@ -1634,15 +1633,13 @@ yyreduce:
{
(*parsed) << (yyvsp[(2) - (2)].val_char);
}
mem_collector_free(mc,(yyvsp[(1) - (2)].val_str));
;}
break;
case 6:
/* Line 1464 of yacc.c */
#line 269 "vm_var_syntax.y"
#line 266 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (5)].val_str));
string vname((yyvsp[(3) - (5)].val_str));
@ -1656,16 +1653,13 @@ yyreduce:
{
(*parsed) << (yyvsp[(5) - (5)].val_char);
}
mem_collector_free(mc,(yyvsp[(1) - (5)].val_str));
mem_collector_free(mc,(yyvsp[(3) - (5)].val_str));
;}
break;
case 7:
/* Line 1464 of yacc.c */
#line 287 "vm_var_syntax.y"
#line 281 "vm_var_syntax.y"
{
string name((yyvsp[(1) - (9)].val_str));
string vname((yyvsp[(3) - (9)].val_str));
@ -1682,18 +1676,13 @@ yyreduce:
{
(*parsed) << (yyvsp[(9) - (9)].val_char);
}
mem_collector_free(mc,(yyvsp[(1) - (9)].val_str));
mem_collector_free(mc,(yyvsp[(3) - (9)].val_str));
mem_collector_free(mc,(yyvsp[(5) - (9)].val_str));
mem_collector_free(mc,(yyvsp[(7) - (9)].val_str));
;}
break;
/* Line 1464 of yacc.c */
#line 1697 "vm_var_syntax.cc"
#line 1686 "vm_var_syntax.cc"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@ -1912,7 +1901,7 @@ yyreturn:
/* Line 1684 of yacc.c */
#line 310 "vm_var_syntax.y"
#line 299 "vm_var_syntax.y"
extern "C" void vm_var__error(

View File

@ -248,7 +248,6 @@ vm_string: vm_variable
vm_variable:RSTRING
{
(*parsed) << $1;
mem_collector_free(mc,$1);
}
| VARIABLE EOA
{
@ -262,8 +261,6 @@ vm_variable:RSTRING
{
(*parsed) << $2;
}
mem_collector_free(mc,$1);
}
| VARIABLE OBRACKET VARIABLE CBRACKET EOA
{
@ -279,9 +276,6 @@ vm_variable:RSTRING
{
(*parsed) << $5;
}
mem_collector_free(mc,$1);
mem_collector_free(mc,$3);
}
| VARIABLE OBRACKET VARIABLE COMMA VARIABLE EQUAL STRING CBRACKET EOA
{
@ -300,11 +294,6 @@ vm_variable:RSTRING
{
(*parsed) << $9;
}
mem_collector_free(mc,$1);
mem_collector_free(mc,$3);
mem_collector_free(mc,$5);
mem_collector_free(mc,$7);
}
;
%%