$NetBSD: patch-ae,v 1.1 2006/06/25 13:46:37 wiz Exp $ Fixes gcc4 problem: error: invalid storage class for function 'non_greedy_parsing' --- src/plugins/links2/links2_parse.lex.orig 2003-11-29 13:14:14.000000000 +0000 +++ src/plugins/links2/links2_parse.lex @@ -31,6 +31,7 @@ #undef YY_USES_REJECT +static char *non_greedy_parsing (pattern [], char []); %} %option noyywrap @@ -46,65 +47,6 @@ %% -%{ - -static char *non_greedy_parsing (pattern stop_pattern[], char yytext[]) -{ - char_vector *text_cv = char_vector_new (text_cv, 100); - char *text_end = NULL; - char *text; - int in, i, which, chr_cnt = 0; - - char_vector_add (text_cv, yytext[0]); - - while ((text_end == NULL) && ((in = input ()) != EOF)) - { - char_vector_add (text_cv, in); - chr_cnt++; - - for (which = 0; stop_pattern[which].text != NULL; which++) - { - if (chr_cnt > stop_pattern[which].length) - { - stop_pattern[which].text_ptr++; - } - } - - for (which = 0; stop_pattern[which].text != NULL; which++) - { - text_end = strstr ((text_cv->vector) + stop_pattern[which].text_ptr, - stop_pattern[which].text); - if (text_end != NULL) - { - break; - } - } - } - - if (text_end != NULL) - { - *text_end = '\0'; - - for (i = strlen (stop_pattern[which].text) - 1; i >= 0; i--) - { - unput (stop_pattern[which].text[i]); - } - } - else - { - char_vector_del (text_cv); - return NULL; - } - - text = strdup (text_cv->vector); - char_vector_del (text_cv); - - return text; -} - -%} - - %{ /************************************************************************ @@ -229,6 +171,60 @@ static char *non_greedy_parsing (pattern %% +static char *non_greedy_parsing (pattern stop_pattern[], char yytext[]) +{ + char_vector *text_cv = char_vector_new (text_cv, 100); + char *text_end = NULL; + char *text; + int in, i, which, chr_cnt = 0; + + char_vector_add (text_cv, yytext[0]); + + while ((text_end == NULL) && ((in = input ()) != EOF)) + { + char_vector_add (text_cv, in); + chr_cnt++; + + for (which = 0; stop_pattern[which].text != NULL; which++) + { + if (chr_cnt > stop_pattern[which].length) + { + stop_pattern[which].text_ptr++; + } + } + + for (which = 0; stop_pattern[which].text != NULL; which++) + { + text_end = strstr ((text_cv->vector) + stop_pattern[which].text_ptr, + stop_pattern[which].text); + if (text_end != NULL) + { + break; + } + } + } + + if (text_end != NULL) + { + *text_end = '\0'; + + for (i = strlen (stop_pattern[which].text) - 1; i >= 0; i--) + { + unput (stop_pattern[which].text[i]); + } + } + else + { + char_vector_del (text_cv); + return NULL; + } + + text = strdup (text_cv->vector); + char_vector_del (text_cv); + + return text; +} + void yyerror (char *error_message) {