X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Foptions%2Fparser.yy;h=722ced5f9db6ffd41669cd9a96336f0624671ea7;hb=9fd31c03436acf24c593dc3a77c905eb137ef570;hp=7a8283ec490fd46f1590b55a318e2d9533289d21;hpb=cfaa34d5cd9f5b393ee49cad1eee854dedce4b72;p=awesomized%2Flibmemcached diff --git a/libmemcached/options/parser.yy b/libmemcached/options/parser.yy index 7a8283ec..722ced5f 100644 --- a/libmemcached/options/parser.yy +++ b/libmemcached/options/parser.yy @@ -40,8 +40,9 @@ #include #include +#include + #include -#include #include #include @@ -136,19 +137,21 @@ inline void config_error(Context *context, yyscan_t *scanner, const char *error) %token FLOAT %token NUMBER -%token PORT -%token WEIGHT_START +%token PORT +%token WEIGHT_START %token IPADDRESS %token HOSTNAME %token STRING %token QUOTED_STRING %token FILE_PATH -%type string -%type distribution -%type hash %type behavior_boolean %type behavior_number +%type distribution +%type hash +%type optional_port +%type optional_weight +%type string %% @@ -184,7 +187,7 @@ statement: } | INCLUDE ' ' string { - if ((context->rc= memcached_parse_configure_file(context->memc, $3.c_str, $3.length)) != MEMCACHED_SUCCESS) + if ((context->rc= memcached_parse_configure_file(*context->memc, $3.c_str, $3.size)) != MEMCACHED_SUCCESS) { parser_abort(context, NULL); } @@ -195,7 +198,7 @@ statement: expression: SERVER HOSTNAME optional_port optional_weight { - if ((context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $2.port, $2.weight)) != MEMCACHED_SUCCESS) + if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $3, $4))) { parser_abort(context, NULL); } @@ -203,7 +206,7 @@ expression: } | SERVER IPADDRESS optional_port optional_weight { - if ((context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $2.port, $2.weight)) != MEMCACHED_SUCCESS) + if (memcached_failed(context->rc= memcached_server_add_with_weight(context->memc, $2.c_str, $3, $4))) { parser_abort(context, NULL); } @@ -211,7 +214,7 @@ expression: } | CONFIGURE_FILE string { - memcached_set_configuration_file(context->memc, $2.c_str, $2.length); + memcached_set_configuration_file(context->memc, $2.c_str, $2.size); } | POOL_MIN NUMBER { @@ -227,7 +230,7 @@ expression: behaviors: NAMESPACE string { - if ((context->rc= memcached_set_prefix_key(context->memc, $2.c_str, $2.length)) != MEMCACHED_SUCCESS) + if ((context->rc= memcached_set_prefix_key(context->memc, $2.c_str, $2.size)) != MEMCACHED_SUCCESS) { parser_abort(context, NULL);; } @@ -379,13 +382,13 @@ behavior_boolean: optional_port: - { } + { $$= MEMCACHED_DEFAULT_PORT;} | PORT { }; ; optional_weight: - { } + { $$= 1; } | WEIGHT_START { } ; @@ -437,7 +440,7 @@ string: | QUOTED_STRING { $$.c_str= $1.c_str +1; // +1 to move use passed the initial quote - $$.length= $1.length -1; // -1 removes the end quote + $$.size= $1.size -2; // -2 removes the begin and end quote } ;