Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3fe721

Browse files
committed
Eliminate function start_parse_fh and macro YY_INPUT
1 parent432ca91 commitd3fe721

File tree

4 files changed

+0
-79
lines changed

4 files changed

+0
-79
lines changed

‎contrib/tsearch/parser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ char *token;
55
inttokenlen;
66
inttsearch_yylex(void);
77
voidstart_parse_str(char*,int);
8-
voidstart_parse_fh(FILE*,int);
98
voidend_parse(void);
109

1110
#endif

‎contrib/tsearch/parser.l

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,6 @@ char *s = NULL; /* to return WHOLE hyphenated-word */
2222

2323
YY_BUFFER_STATE buf =NULL;/* buffer to parse; it need for parse from string*/
2424

25-
int lrlimit = -1;/* for limiting read from filehandle ( -1 - unlimited read )*/
26-
int bytestoread =0;/* for limiting read from filehandle*/
27-
28-
/* redefine macro for read limited length*/
29-
#defineYY_INPUT(buf,result,max_size) \
30-
if ( yy_current_buffer->yy_is_interactive ) { \
31-
int c ='*', n; \
32-
for ( n =0; n < max_size && \
33-
(c =getc( tsearch_yyin )) != EOF && c !='\n'; ++n ) \
34-
buf[n] = (char) c; \
35-
if ( c =='\n' ) \
36-
buf[n++] = (char) c; \
37-
if ( c == EOF &&ferror( tsearch_yyin ) ) \
38-
YY_FATAL_ERROR("input in flex scanner failed" ); \
39-
result = n; \
40-
}else { \
41-
if ( lrlimit ==0 ) \
42-
result=YY_NULL; \
43-
else { \
44-
if ( lrlimit>0 ) { \
45-
bytestoread = ( lrlimit > max_size ) ? max_size : lrlimit; \
46-
lrlimit -= bytestoread; \
47-
}else \
48-
bytestoread = max_size; \
49-
if ( ((result =fread( buf,1, bytestoread, tsearch_yyin )) ==0) \
50-
&&ferror( tsearch_yyin ) ) \
51-
YY_FATAL_ERROR("input in flex scanner failed" ); \
52-
} \
53-
}
54-
5525
%}
5626

5727
%option8bit
@@ -327,13 +297,4 @@ void start_parse_str(char* str, int limit) {
327297
BEGIN INITIAL;
328298
}
329299

330-
/* start parse from filehandle */
331-
voidstart_parse_fh( FILE* fh,int limit ) {
332-
if (buf)end_parse();
333-
lrlimit = ( limit ) ? limit : -1;
334-
buf =tsearch_yy_create_buffer( fh, YY_BUF_SIZE );
335-
tsearch_yy_switch_to_buffer( buf );
336-
BEGIN INITIAL;
337-
}
338-
339300

‎contrib/tsearch2/wordparser/parser.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ char *token;
55
inttokenlen;
66
inttsearch2_yylex(void);
77
voidstart_parse_str(char*,int);
8-
voidstart_parse_fh(FILE*,int);
98
voidend_parse(void);
109

1110
#endif

‎contrib/tsearch2/wordparser/parser.l

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,6 @@ char *s = NULL; /* to return WHOLE hyphenated-word */
2323

2424
YY_BUFFER_STATE buf =NULL;/* buffer to parse; it need for parse from string*/
2525

26-
int lrlimit = -1;/* for limiting read from filehandle ( -1 - unlimited read )*/
27-
int bytestoread =0;/* for limiting read from filehandle*/
28-
29-
/* redefine macro for read limited length*/
30-
#defineYY_INPUT(buf,result,max_size) \
31-
if ( yy_current_buffer->yy_is_interactive ) { \
32-
int c ='*', n; \
33-
for ( n =0; n < max_size && \
34-
(c =getc( tsearch2_yyin )) != EOF && c !='\n'; ++n ) \
35-
buf[n] = (char) c; \
36-
if ( c =='\n' ) \
37-
buf[n++] = (char) c; \
38-
if ( c == EOF &&ferror( tsearch2_yyin ) ) \
39-
YY_FATAL_ERROR("input in flex scanner failed" ); \
40-
result = n; \
41-
}else { \
42-
if ( lrlimit ==0 ) \
43-
result=YY_NULL; \
44-
else { \
45-
if ( lrlimit>0 ) { \
46-
bytestoread = ( lrlimit > max_size ) ? max_size : lrlimit; \
47-
lrlimit -= bytestoread; \
48-
}else \
49-
bytestoread = max_size; \
50-
if ( ((result =fread( buf,1, bytestoread, tsearch2_yyin )) ==0) \
51-
&&ferror( tsearch2_yyin ) ) \
52-
YY_FATAL_ERROR("input in flex scanner failed" ); \
53-
} \
54-
}
55-
5626
%}
5727

5828
%option8bit
@@ -334,13 +304,5 @@ void start_parse_str(char* str, int limit) {
334304
BEGIN INITIAL;
335305
}
336306

337-
/* start parse from filehandle */
338-
voidstart_parse_fh( FILE* fh,int limit ) {
339-
if (buf)end_parse();
340-
lrlimit = ( limit ) ? limit : -1;
341-
buf =tsearch2_yy_create_buffer( fh, YY_BUF_SIZE );
342-
tsearch2_yy_switch_to_buffer( buf );
343-
BEGIN INITIAL;
344-
}
345307

346308

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp