Skip to content

Commit 4766bcd

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 Naylor Discussion: https://postgr.es/m/CAJVSVGWGqY9YBs2EwtRUkbNv=hXkN8yRPOoD1wxE6COgvvrz5g@mail.gmail.com
1 parent ec937d0 commit 4766bcd

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
extern int base_yyparse(void);
7777
extern int base_yylex(void);
7878
extern void base_yyerror(const char *);
79-
extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
79+
extern void *mm_alloc(size_t);
8080
extern char *mm_strdup(const char *);
8181
extern void mmerror(int errorcode, enum errortype type, const char *error,...) pg_attribute_printf(3, 4);
8282
extern void mmfatal(int errorcode, const char *error,...) pg_attribute_printf(2, 3) pg_attribute_noreturn();
@@ -105,9 +105,7 @@ extern void remove_variables(int);
105105
extern struct variable *new_variable(const char *, struct ECPGtype *, int);
106106
extern const ScanKeyword *ScanCKeywordLookup(const char *);
107107
extern const ScanKeyword *ScanECPGKeywordLookup(const char *text);
108-
extern void scanner_init(const char *);
109108
extern void parser_init(void);
110-
extern void scanner_finish(void);
111109
extern int filtered_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
static int xcdepth = 0; /* depth of nesting in slash-star comments */
3636
static char *dolqstart = NULL; /* current $foo$ quote start string */
37-
static YY_BUFFER_STATE scanbufhandle;
38-
static char *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
return false;
16661664
}
1667-
1668-
/*
1669-
* Called before any actual parsing is done
1670-
*/
1671-
void
1672-
scanner_init(const char *str)
1673-
{
1674-
Size slen = 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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy