X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Foptions%2Fscanner.l;h=b3fce3c317f0ef83f4c1febd76fa4d63ed493b1e;hb=81416ab2d4fe60d5c71ea11326a351993c539002;hp=ccfc55aa570752559a34a99bdab1299bbb9fea02;hpb=2a34f4dcac48917e41a1b6aee37edbe886aa9f7b;p=awesomized%2Flibmemcached diff --git a/libmemcached/options/scanner.l b/libmemcached/options/scanner.l index ccfc55aa..b3fce3c3 100644 --- a/libmemcached/options/scanner.l +++ b/libmemcached/options/scanner.l @@ -3,17 +3,17 @@ * Libmemcached Scanner and Parser * * Copyright (C) 2011 DataDifferental, http://datadifferential.com - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. - * + * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ @@ -22,7 +22,6 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wunused-parameter" -#pragma GCC diagnostic ignored "-fpermissive" #include #include @@ -40,19 +39,19 @@ #define PARAM yyget_extra(yyscanner) -static void get_lex_chars(char* buffer, int& result, int max_size, Context *context) -{ - if (context->pos >= context->length) - { - result= YY_NULL; - } - else - { - result= context->length - context->pos; - result > (int)max_size ? result = max_size : 0; - memcpy(buffer, context->buf + context->pos, result); - context->pos += result; - } +#define get_lex_chars(buffer, result, max_size, context) \ +{ \ + if (context->pos >= context->length) \ + { \ + result= YY_NULL; \ + } \ + else \ + { \ + result= context->length - context->pos; \ + result > max_size ? result = max_size : 0; \ + memcpy(buffer, context->buf + context->pos, result); \ + context->pos += result; \ + } \ } @@ -181,13 +180,13 @@ HSIEH { return HSIEH; } MURMUR { return MURMUR; } JENKINS { return JENKINS; } -[[:alnum:]][[:alnum:].]*[[:alpha:]]: { +[[:alnum:]][[:alnum:].]*[[:alpha:]]: { yylval->string.c_str = yytext; yylval->string.length = yyleng; return HOSTNAME_WITH_PORT; } -[[:alnum:]]+"."[[:alpha:].]+[[:alnum:]] { +[[:alnum:]]+"."[[:alpha:].]+[[:alnum:]] { yylval->string.c_str = yytext; yylval->string.length = yyleng; return HOSTNAME; @@ -205,7 +204,7 @@ JENKINS { return JENKINS; } return IPADDRESS; } -[[:alnum:]]+ { +[[:alnum:]]+ { yylval->string.c_str = yytext; yylval->string.length = yyleng; return STRING;