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

Commit4766bcd

Browse files
committed
Remove unused code in ECPG.
scanner_init/scanner_finish weren't actually called from anywhere,and the scanbuf variables they set up weren't used either.Remove unused declaration for mm_realloc, too.John NaylorDiscussion:https://postgr.es/m/CAJVSVGWGqY9YBs2EwtRUkbNv=hXkN8yRPOoD1wxE6COgvvrz5g@mail.gmail.com
1 parentec937d0 commit4766bcd

File tree

2 files changed

+2
-47
lines changed

2 files changed

+2
-47
lines changed

‎src/interfaces/ecpg/preproc/extern.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ extern char *hashline_number(void);
7676
externintbase_yyparse(void);
7777
externintbase_yylex(void);
7878
externvoidbase_yyerror(constchar*);
79-
externvoid*mm_alloc(size_t),*mm_realloc(void*,size_t);
79+
externvoid*mm_alloc(size_t);
8080
externchar*mm_strdup(constchar*);
8181
externvoidmmerror(interrorcode,enumerrortypetype,constchar*error,...)pg_attribute_printf(3,4);
8282
externvoidmmfatal(interrorcode,constchar*error,...)pg_attribute_printf(2,3)pg_attribute_noreturn();
@@ -105,9 +105,7 @@ extern void remove_variables(int);
105105
externstructvariable*new_variable(constchar*,structECPGtype*,int);
106106
externconstScanKeyword*ScanCKeywordLookup(constchar*);
107107
externconstScanKeyword*ScanECPGKeywordLookup(constchar*text);
108-
externvoidscanner_init(constchar*);
109108
externvoidparser_init(void);
110-
externvoidscanner_finish(void);
111109
externintfiltered_base_yylex(void);
112110

113111
/* return codes */

‎src/interfaces/ecpg/preproc/pgc.l

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ extern YYSTYPE base_yylval;
3434

3535
staticintxcdepth =0;/* depth of nesting in slash-star comments*/
3636
staticchar *dolqstart =NULL;/* current $foo$ quote start string*/
37-
static YY_BUFFER_STATE scanbufhandle;
38-
staticchar *scanbuf;
3937

4038
/*
4139
* literalbuf is used to accumulate literal values when multiple rules
@@ -1436,7 +1434,7 @@ lex_init(void)
14361434
if (literalbuf ==NULL)
14371435
{
14381436
literalalloc =1024;
1439-
literalbuf = (char *)malloc(literalalloc);
1437+
literalbuf = (char *)mm_alloc(literalalloc);
14401438
}
14411439
startlit();
14421440

@@ -1664,44 +1662,3 @@ static bool isinformixdefine(void)
16641662

16651663
returnfalse;
16661664
}
1667-
1668-
/*
1669-
* Called before any actual parsing is done
1670-
*/
1671-
void
1672-
scanner_init(constchar *str)
1673-
{
1674-
Sizeslen =strlen(str);
1675-
1676-
/*
1677-
* Might be left over after ereport()
1678-
*/
1679-
if (YY_CURRENT_BUFFER)
1680-
yy_delete_buffer(YY_CURRENT_BUFFER);
1681-
1682-
/*
1683-
* Make a scan buffer with special termination needed by flex.
1684-
*/
1685-
scanbuf =mm_alloc(slen +2);
1686-
memcpy(scanbuf, str, slen);
1687-
scanbuf[slen] = scanbuf[slen +1] = YY_END_OF_BUFFER_CHAR;
1688-
scanbufhandle =yy_scan_buffer(scanbuf, slen +2);
1689-
1690-
/* initialize literal buffer to a reasonable but expansible size */
1691-
literalalloc =128;
1692-
literalbuf = (char *)mm_alloc(literalalloc);
1693-
startlit();
1694-
1695-
BEGIN(INITIAL);
1696-
}
1697-
1698-
1699-
/*
1700-
* Called after parsing is done to clean up after scanner_init()
1701-
*/
1702-
void
1703-
scanner_finish(void)
1704-
{
1705-
yy_delete_buffer(scanbufhandle);
1706-
free(scanbuf);
1707-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp