Fix (test for) lp:655423
[m6w6/libmemcached] / libmemcached / options / parser.cc
index 91dfcd297ff905448632176b8a4ad0e6dba558ae..d199a5fa08ab59df51f83745908b96465f641137 100644 (file)
 
 #include <stdint.h>
 
+#include <libmemcached/common.h>
 #include <libmemcached/options/context.h>
-#include <libmemcached/options/string.h>
 #include <libmemcached/options/symbol.h>
-#include <libmemcached/visibility.h>
-#include <libmemcached/prefix_key.h>
+#include <libmemcached/options/scanner.h>
 
 #pragma GCC diagnostic ignored "-Wold-style-cast"
-#include <libmemcached/options/scanner.h>
 
 int conf_lex(YYSTYPE* lvalp, void* scanner);
 
@@ -104,7 +102,7 @@ inline void config_error(Context *context, yyscan_t *scanner, const char *error)
 
 
 /* Line 189 of yacc.c  */
-#line 108 "libmemcached/options/parser.cc"
+#line 106 "libmemcached/options/parser.cc"
 
 /* Enabling traces.  */
 #ifndef YYDEBUG
@@ -215,7 +213,7 @@ inline void config_error(Context *context, yyscan_t *scanner, const char *error)
 
 
 /* Line 264 of yacc.c  */
-#line 219 "libmemcached/options/parser.cc"
+#line 217 "libmemcached/options/parser.cc"
 
 #ifdef short
 # undef short
@@ -1583,7 +1581,7 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 187 "libmemcached/options/parser.yy"
     {
-            if ((context->rc= memcached_parse_configure_file(context->memc, (yyvsp[(3) - (3)].string).c_str, (yyvsp[(3) - (3)].string).length)) != MEMCACHED_SUCCESS)
+            if ((context->rc= memcached_parse_configure_file(context->memc, (yyvsp[(3) - (3)].string).c_str, (yyvsp[(3) - (3)].string).size)) != MEMCACHED_SUCCESS)
             {
               parser_abort(context, NULL);
             }
@@ -1595,7 +1593,7 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 198 "libmemcached/options/parser.yy"
     {
-            if ((context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(2) - (4)].server).port, (yyvsp[(2) - (4)].server).weight)) != MEMCACHED_SUCCESS)
+            if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number))))
             {
               parser_abort(context, NULL);
             }
@@ -1608,7 +1606,7 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 206 "libmemcached/options/parser.yy"
     {
-            if ((context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(2) - (4)].server).port, (yyvsp[(2) - (4)].server).weight)) != MEMCACHED_SUCCESS)
+            if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, (yyvsp[(2) - (4)].server).c_str, (yyvsp[(3) - (4)].number), (yyvsp[(4) - (4)].number))))
             {
               parser_abort(context, NULL);
             }
@@ -1621,7 +1619,7 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 214 "libmemcached/options/parser.yy"
     {
-            memcached_set_configuration_file(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).length);
+            memcached_set_configuration_file(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size);
           ;}
     break;
 
@@ -1648,7 +1646,7 @@ yyreduce:
 /* Line 1464 of yacc.c  */
 #line 230 "libmemcached/options/parser.yy"
     {
-            if ((context->rc= memcached_set_prefix_key(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).length)) != MEMCACHED_SUCCESS)
+            if ((context->rc= memcached_set_prefix_key(context->memc, (yyvsp[(2) - (2)].string).c_str, (yyvsp[(2) - (2)].string).size)) != MEMCACHED_SUCCESS)
             {
               parser_abort(context, NULL);;
             }
@@ -1947,7 +1945,7 @@ yyreduce:
 
 /* Line 1464 of yacc.c  */
 #line 383 "libmemcached/options/parser.yy"
-    { ;}
+    { (yyval.number)= MEMCACHED_DEFAULT_PORT;;}
     break;
 
   case 50:
@@ -1961,7 +1959,7 @@ yyreduce:
 
 /* Line 1464 of yacc.c  */
 #line 389 "libmemcached/options/parser.yy"
-    { ;}
+    { (yyval.number)= 1; ;}
     break;
 
   case 52:
@@ -2067,7 +2065,7 @@ yyreduce:
 #line 439 "libmemcached/options/parser.yy"
     {
             (yyval.string).c_str= (yyvsp[(1) - (1)].string).c_str +1; // +1 to move use passed the initial quote
-            (yyval.string).length= (yyvsp[(1) - (1)].string).length -1; // -1 removes the end quote
+            (yyval.string).size= (yyvsp[(1) - (1)].string).size -2; // -2 removes the begin and end quote
           ;}
     break;
 
@@ -2101,7 +2099,7 @@ yyreduce:
 
 
 /* Line 1464 of yacc.c  */
-#line 2105 "libmemcached/options/parser.cc"
+#line 2103 "libmemcached/options/parser.cc"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);