From 2e4beab16ef9a7cfc09277cfc14b8702c6368b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20S=2E=20Montero?= Date: Fri, 6 Mar 2009 15:11:32 +0000 Subject: [PATCH] Minor change, loop condition git-svn-id: http://svn.opennebula.org/one/trunk@388 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/vm/vm_var_syntax.cc | 12 +++++++----- src/vm/vm_var_syntax.y | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/vm/vm_var_syntax.cc b/src/vm/vm_var_syntax.cc index 9daf035c88..7bf81c4c7d 100644 --- a/src/vm/vm_var_syntax.cc +++ b/src/vm/vm_var_syntax.cc @@ -478,7 +478,7 @@ static const yytype_int8 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 81, 81, 82, 85, 90, 108, 140, 178 + 0, 81, 81, 82, 85, 90, 108, 140, 180 }; #endif @@ -1515,7 +1515,9 @@ yyreduce: VM_VAR_TO_UPPER(vname); VM_VAR_TO_UPPER(vvar); - for (int i=0 ; iget_template_attribute(name,values) ; i++) + int num = vm->get_template_attribute(name,values); + + for (int i=0 ; i < num ; i++) { vattr = dynamic_cast(values[i]); @@ -1541,7 +1543,7 @@ yyreduce: break; case 8: -#line 179 "vm_var_syntax.y" +#line 181 "vm_var_syntax.y" { string name((yyvsp[(3) - (4)].val_str)); string value = ""; @@ -1582,7 +1584,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 1586 "vm_var_syntax.cc" +#line 1588 "vm_var_syntax.cc" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1802,7 +1804,7 @@ yyreturn: } -#line 216 "vm_var_syntax.y" +#line 218 "vm_var_syntax.y" extern "C" void vm_var_error( diff --git a/src/vm/vm_var_syntax.y b/src/vm/vm_var_syntax.y index 79fad1c347..d3017df9be 100644 --- a/src/vm/vm_var_syntax.y +++ b/src/vm/vm_var_syntax.y @@ -152,7 +152,9 @@ vm_variable:RSTRING VM_VAR_TO_UPPER(vname); VM_VAR_TO_UPPER(vvar); - for (int i=0 ; iget_template_attribute(name,values) ; i++) + int num = vm->get_template_attribute(name,values); + + for (int i=0 ; i < num ; i++) { vattr = dynamic_cast(values[i]);