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

Commit607cd93

Browse files
author
Thomas G. Lockhart
committed
Changes from Michael Meskes:
Check strdup calls for out of memory.Set library version to 2.6.2Synced preproc.y and keywords.c with gram.y and keywords.c yet again.Set version to 2.4.3
1 parentcbfc9ec commit607cd93

File tree

9 files changed

+177
-100
lines changed

9 files changed

+177
-100
lines changed

‎src/interfaces/ecpg/lib/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PQ_INCLUDE=-I$(SRCDIR)/interfaces/libpq
55

66
SO_MAJOR_VERSION=2
77
SO_MINOR_VERSION=6
8-
SO_PATCHLEVEL=1
8+
SO_PATCHLEVEL=2
99

1010
PORTNAME=@PORTNAME@
1111

‎src/interfaces/ecpg/lib/ecpglib.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@ ecpg_alloc(long size, int lineno)
148148
return (new);
149149
}
150150

151+
staticchar*
152+
ecpg_strdup(constchar*string,intlineno)
153+
{
154+
char*new=strdup(string);
155+
156+
if (!new)
157+
{
158+
ECPGfinish(actual_connection);
159+
ECPGlog("out of memory\n");
160+
register_error(ECPG_OUT_OF_MEMORY,"out of memory in line %d",lineno);
161+
returnNULL;
162+
}
163+
164+
return (new);
165+
}
166+
151167
/* This function returns a newly malloced string that has the ' and \
152168
in the argument quoted with \.
153169
*/
@@ -246,7 +262,7 @@ ECPGexecute(struct statement * stmt)
246262

247263
memcpy((char*)&sqlca, (char*)&sqlca_init,sizeof(sqlca));
248264

249-
copiedquery=strdup(stmt->command);
265+
copiedquery=ecpg_strdup(stmt->command,stmt->lineno);
250266

251267
/*
252268
* Now, if the type is one of the fill in types then we take the
@@ -914,9 +930,9 @@ ECPGconnect(int lineno, const char *dbname, const char *user, const char *passwd
914930

915931
/* add connection to our list */
916932
if (connection_name!=NULL)
917-
this->name=strdup(connection_name);
933+
this->name=ecpg_strdup(connection_name,lineno);
918934
else
919-
this->name=strdup(dbname);
935+
this->name=ecpg_strdup(dbname,lineno);
920936

921937
if (all_connections==NULL)
922938
this->next=NULL;

‎src/interfaces/ecpg/preproc/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include $(SRCDIR)/Makefile.global
33

44
MAJOR_VERSION=2
55
MINOR_VERSION=4
6-
PATCHLEVEL=2
6+
PATCHLEVEL=3
77

88
CFLAGS+=-I../include -DMAJOR_VERSION=$(MAJOR_VERSION)\
99
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL)\
@@ -27,6 +27,10 @@ uninstall:
2727
ecpg:$(OBJ)
2828
$(CC) -o ecpg$(OBJ)$(LEXLIB)$(LDFLAGS)
2929

30+
pgc.c: pgc.l
31+
$(LEX)$<
32+
mv lex.yy.c pgc.c
33+
3034
y.tab.hy.tab.c: preproc.y
3135
$(YACC)$(YFLAGS)$<
3236

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extern void lex_init(void);
6767
externchar*input_filename;
6868
externintyyparse(void);
6969
externvoid*mm_alloc(size_t),*mm_realloc(void*,size_t);
70+
externchar*mm_strdup(constchar*);
7071
ScanKeyword*ScanECPGKeywordLookup(char*);
7172
ScanKeyword*ScanCKeywordLookup(char*);
7273
externvoidyyerror(char*);

‎src/interfaces/ecpg/preproc/keywords.c

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.5 1998/09/21 05:52:53 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.6 1998/10/03 02:33:36 thomas Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -29,8 +29,9 @@
2929
* search is used to locate entries.
3030
*/
3131
staticScanKeywordScanKeywords[]= {
32-
/* namevalue*/
32+
/* name,value*/
3333
{"abort",ABORT_TRANS},
34+
{"absolute",ABSOLUTE},
3435
{"action",ACTION},
3536
{"add",ADD},
3637
{"after",AFTER},
@@ -40,7 +41,6 @@ static ScanKeyword ScanKeywords[] = {
4041
{"analyze",ANALYZE},
4142
{"and",AND},
4243
{"any",ANY},
43-
{"archive",ARCHIVE},
4444
{"as",AS},
4545
{"asc",ASC},
4646
{"backward",BACKWARD},
@@ -67,7 +67,9 @@ static ScanKeyword ScanKeywords[] = {
6767
{"createdb",CREATEDB},
6868
{"createuser",CREATEUSER},
6969
{"cross",CROSS},
70-
{"current",CURRENT},
70+
{"current",CURRENT},/* 6.4 to 6.5 is migration time! CURRENT
71+
* will be removed in 6.5! Use OLD keyword
72+
* in rules. Jan */
7173
{"current_date",CURRENT_DATE},
7274
{"current_time",CURRENT_TIME},
7375
{"current_timestamp",CURRENT_TIMESTAMP},
@@ -87,6 +89,7 @@ static ScanKeyword ScanKeywords[] = {
8789
{"double",DOUBLE},
8890
{"drop",DROP},
8991
{"each",EACH},
92+
{"encoding",ENCODING},
9093
{"end",END_TRANS},
9194
{"execute",EXECUTE},
9295
{"exists",EXISTS},
@@ -113,6 +116,7 @@ static ScanKeyword ScanKeywords[] = {
113116
{"inherits",INHERITS},
114117
{"inner",INNER_P},
115118
{"insert",INSERT},
119+
{"insensitive",INSENSITIVE},
116120
{"instead",INSTEAD},
117121
{"interval",INTERVAL},
118122
{"into",INTO},
@@ -136,10 +140,12 @@ static ScanKeyword ScanKeywords[] = {
136140
{"minvalue",MINVALUE},
137141
{"month",MONTH_P},
138142
{"move",MOVE},
143+
{"names",NAMES},
139144
{"national",NATIONAL},
140145
{"natural",NATURAL},
141146
{"nchar",NCHAR},
142147
{"new",NEW},
148+
{"next",NEXT},
143149
{"no",NO},
144150
{"nocreatedb",NOCREATEDB},
145151
{"nocreateuser",NOCREATEUSER},
@@ -152,7 +158,9 @@ static ScanKeyword ScanKeywords[] = {
152158
{"numeric",NUMERIC},
153159
{"of",OF},
154160
{"oids",OIDS},
161+
{"old",CURRENT},
155162
{"on",ON},
163+
{"only",ONLY},
156164
{"operator",OPERATOR},
157165
{"option",OPTION},
158166
{"or",OR},
@@ -163,12 +171,15 @@ static ScanKeyword ScanKeywords[] = {
163171
{"position",POSITION},
164172
{"precision",PRECISION},
165173
{"primary",PRIMARY},
174+
{"prior",PRIOR},
166175
{"privileges",PRIVILEGES},
167176
{"procedural",PROCEDURAL},
168177
{"procedure",PROCEDURE},
169178
{"public",PUBLIC},
179+
{"read",READ},
170180
{"recipe",RECIPE},
171181
{"references",REFERENCES},
182+
{"relative",RELATIVE},
172183
{"rename",RENAME},
173184
{"reset",RESET},
174185
{"returns",RETURNS},
@@ -177,9 +188,11 @@ static ScanKeyword ScanKeywords[] = {
177188
{"rollback",ROLLBACK},
178189
{"row",ROW},
179190
{"rule",RULE},
191+
{"scroll",SCROLL},
180192
{"second",SECOND_P},
181193
{"select",SELECT},
182194
{"sequence",SEQUENCE},
195+
{"serial",SERIAL},
183196
{"set",SET},
184197
{"setof",SETOF},
185198
{"show",SHOW},
@@ -190,6 +203,7 @@ static ScanKeyword ScanKeywords[] = {
190203
{"substring",SUBSTRING},
191204
{"table",TABLE},
192205
{"time",TIME},
206+
{"timestamp",TIMESTAMP},
193207
{"timezone_hour",TIMEZONE_HOUR},
194208
{"timezone_minute",TIMEZONE_MINUTE},
195209
{"to",TO},

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
#undef yywrap
3535
#endif/* yywrap */
3636

37-
int debugging =0;
3837
extern YYSTYPE yylval;
3938
int llen;
4039
char literal[MAX_PARSE_BUFFER];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp