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

Commit150131d

Browse files
author
Michael Meskes
committed
- Made several variables "const char *" instead of "char *" as proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
- Replaced all strdup() calls by ECPGstrdup().- Set ecpg library version to 5.2.- Set ecpg version to 4.2.1.
1 parent339fbbb commit150131d

File tree

8 files changed

+49
-40
lines changed

8 files changed

+49
-40
lines changed

‎src/interfaces/ecpg/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,3 +1952,11 @@ Wed Oct 5 16:57:42 CEST 2005
19521952
- Set ecpg library version to 5.1.
19531953
- Set ecpg version to 4.1.1.
19541954

1955+
Wed Nov 30 12:49:13 CET 2005
1956+
1957+
- Made several variables "const char *" instead of "char *" as
1958+
proposed by Qingqing Zhou <zhouqq@cs.toronto.edu>.
1959+
- Replaced all strdup() calls by ECPGstrdup().
1960+
- Set ecpg library version to 5.2.
1961+
- Set ecpg version to 4.2.1.
1962+

‎src/interfaces/ecpg/ecpglib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.33 2005/03/14 17:27:50 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/Makefile,v 1.34 2005/11/30 12:49:49 meskes Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,7 +14,7 @@ include $(top_builddir)/src/Makefile.global
1414

1515
NAME= ecpg
1616
SO_MAJOR_VERSION= 5
17-
SO_MINOR_VERSION=1
17+
SO_MINOR_VERSION=2
1818
DLTYPE= library
1919

2020
overrideCPPFLAGS := -DFRONTEND -I$(top_srcdir)/src/interfaces/ecpg/include\

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.26 2005/10/15 02:49:47 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.27 2005/11/30 12:49:49 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -265,7 +265,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
265265
structsqlca_t*sqlca=ECPGget_sqlca();
266266
enumCOMPAT_MODEcompat=c;
267267
structconnection*this;
268-
char*dbname=name ?strdup(name) :NULL,
268+
char*dbname=name ?ECPGstrdup(name,lineno) :NULL,
269269
*host=NULL,
270270
*tmp,
271271
*port=NULL,
@@ -287,7 +287,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
287287
if (envname)
288288
{
289289
ECPGfree(dbname);
290-
dbname=strdup(envname);
290+
dbname=ECPGstrdup(envname,lineno);
291291
}
292292

293293
}
@@ -307,17 +307,17 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
307307
tmp=strrchr(dbname,':');
308308
if (tmp!=NULL)/* port number given */
309309
{
310-
port=strdup(tmp+1);
310+
port=ECPGstrdup(tmp+1,lineno);
311311
*tmp='\0';
312312
}
313313

314314
tmp=strrchr(dbname,'@');
315315
if (tmp!=NULL)/* host name given */
316316
{
317-
host=strdup(tmp+1);
317+
host=ECPGstrdup(tmp+1,lineno);
318318
*tmp='\0';
319319
}
320-
realname=strdup(dbname);
320+
realname=ECPGstrdup(dbname,lineno);
321321
}
322322
elseif (strncmp(dbname,"tcp:",4)==0||strncmp(dbname,"unix:",5)==0)
323323
{
@@ -345,14 +345,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
345345
tmp=strrchr(dbname+offset,'?');
346346
if (tmp!=NULL)/* options given */
347347
{
348-
options=strdup(tmp+1);
348+
options=ECPGstrdup(tmp+1,lineno);
349349
*tmp='\0';
350350
}
351351

352352
tmp=last_dir_separator(dbname+offset);
353353
if (tmp!=NULL)/* database name given */
354354
{
355-
realname=strdup(tmp+1);
355+
realname=ECPGstrdup(tmp+1,lineno);
356356
*tmp='\0';
357357
}
358358

@@ -365,7 +365,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
365365
if ((tmp2=strchr(tmp+1,':'))!=NULL)
366366
{
367367
*tmp2='\0';
368-
host=strdup(tmp+1);
368+
host=ECPGstrdup(tmp+1,lineno);
369369
if (strncmp(dbname,"unix:",5)!=0)
370370
{
371371
ECPGlog("connect: socketname %s given for TCP connection in line %d\n",host,lineno);
@@ -384,7 +384,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
384384
}
385385
}
386386
else
387-
port=strdup(tmp+1);
387+
port=ECPGstrdup(tmp+1,lineno);
388388
}
389389

390390
if (strncmp(dbname,"unix:",5)==0)
@@ -407,14 +407,14 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
407407
}
408408
}
409409
else
410-
host=strdup(dbname+offset);
410+
host=ECPGstrdup(dbname+offset,lineno);
411411

412412
}
413413
else
414-
realname=strdup(dbname);
414+
realname=ECPGstrdup(dbname,lineno);
415415
}
416416
else
417-
realname=strdup(dbname);
417+
realname=ECPGstrdup(dbname,lineno);
418418
}
419419
else
420420
realname=NULL;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* dynamic SQL support routines
22
*
3-
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.12 2004/08/29 05:06:59 momjian Exp $
3+
* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.13 2005/11/30 12:49:49 meskes Exp $
44
*/
55

66
#definePOSTGRES_ECPG_INTERNAL
@@ -49,7 +49,7 @@ ECPGDynamicType_DDT(Oid type)
4949
}
5050

5151
bool
52-
ECPGget_desc_header(intlineno,char*desc_name,int*count)
52+
ECPGget_desc_header(intlineno,constchar*desc_name,int*count)
5353
{
5454
PGresult*ECPGresult;
5555
structsqlca_t*sqlca=ECPGget_sqlca();
@@ -188,7 +188,7 @@ get_char_item(int lineno, void *var, enum ECPGttype vartype, char *value, int va
188188
}
189189

190190
bool
191-
ECPGget_desc(intlineno,char*desc_name,intindex,...)
191+
ECPGget_desc(intlineno,constchar*desc_name,intindex,...)
192192
{
193193
va_listargs;
194194
PGresult*ECPGresult;
@@ -383,7 +383,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
383383

384384
/* Make sure we do NOT honor the locale for numeric input */
385385
/* since the database gives the standard decimal point */
386-
oldlocale=strdup(setlocale(LC_NUMERIC,NULL));
386+
oldlocale=ECPGstrdup(setlocale(LC_NUMERIC,NULL),lineno);
387387
setlocale(LC_NUMERIC,"C");
388388

389389
memset(&stmt,0,sizeofstmt);
@@ -431,7 +431,7 @@ ECPGget_desc(int lineno, char *desc_name, int index,...)
431431
}
432432

433433
bool
434-
ECPGset_desc_header(intlineno,char*desc_name,intcount)
434+
ECPGset_desc_header(intlineno,constchar*desc_name,intcount)
435435
{
436436
structdescriptor*desc;
437437

@@ -452,7 +452,7 @@ ECPGset_desc_header(int lineno, char *desc_name, int count)
452452
}
453453

454454
bool
455-
ECPGset_desc(intlineno,char*desc_name,intindex,...)
455+
ECPGset_desc(intlineno,constchar*desc_name,intindex,...)
456456
{
457457
va_listargs;
458458
structdescriptor*desc;

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.43 2005/10/15 02:49:47 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.44 2005/11/30 12:49:49 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -141,15 +141,15 @@ ECPGget_variable(va_list APREF, enum ECPGttype type, struct variable * var, bool
141141
* ind_offset - indicator offset
142142
*/
143143
staticbool
144-
create_statement(intlineno,intcompat,intforce_indicator,structconnection*connection,structstatement**stmt,char*query,va_listap)
144+
create_statement(intlineno,intcompat,intforce_indicator,structconnection*connection,structstatement**stmt,constchar*query,va_listap)
145145
{
146146
structvariable**list=&((*stmt)->inlist);
147147
enumECPGttypetype;
148148

149149
if (!(*stmt= (structstatement*)ECPGalloc(sizeof(structstatement),lineno)))
150150
return false;
151151

152-
(*stmt)->command=query;
152+
(*stmt)->command=ECPGstrdup(query,lineno);
153153
(*stmt)->connection=connection;
154154
(*stmt)->lineno=lineno;
155155
(*stmt)->compat=compat;
@@ -224,6 +224,7 @@ free_statement(struct statement * stmt)
224224
return;
225225
free_variable(stmt->inlist);
226226
free_variable(stmt->outlist);
227+
ECPGfree(stmt->command);
227228
ECPGfree(stmt);
228229
}
229230

@@ -1359,7 +1360,7 @@ ECPGexecute(struct statement * stmt)
13591360
}
13601361

13611362
bool
1362-
ECPGdo(intlineno,intcompat,intforce_indicator,constchar*connection_name,char*query,...)
1363+
ECPGdo(intlineno,intcompat,intforce_indicator,constchar*connection_name,constchar*query,...)
13631364
{
13641365
va_listargs;
13651366
structstatement*stmt;
@@ -1369,7 +1370,7 @@ ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name,
13691370

13701371
/* Make sure we do NOT honor the locale for numeric input/output */
13711372
/* since the database wants the standard decimal point */
1372-
oldlocale=strdup(setlocale(LC_NUMERIC,NULL));
1373+
oldlocale=ECPGstrdup(setlocale(LC_NUMERIC,NULL),lineno);
13731374
setlocale(LC_NUMERIC,"C");
13741375

13751376
if (!ECPGinit(con,connection_name,lineno))

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.14 2005/10/15 02:49:47 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.15 2005/11/30 12:49:49 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -60,7 +60,7 @@ replace_variables(char *text)
6060

6161
/* handle the EXEC SQL PREPARE statement */
6262
bool
63-
ECPGprepare(intlineno,char*name,char*variable)
63+
ECPGprepare(intlineno,constchar*name,constchar*variable)
6464
{
6565
structstatement*stmt;
6666
structprepared_statement*this;
@@ -112,7 +112,7 @@ ECPGprepare(int lineno, char *name, char *variable)
112112

113113
/* handle the EXEC SQL DEALLOCATE PREPARE statement */
114114
bool
115-
ECPGdeallocate(intlineno,intc,char*name)
115+
ECPGdeallocate(intlineno,intc,constchar*name)
116116
{
117117
boolret=ECPGdeallocate_one(lineno,name);
118118
enumCOMPAT_MODEcompat=c;
@@ -133,7 +133,7 @@ ECPGdeallocate(int lineno, int c, char *name)
133133
}
134134

135135
bool
136-
ECPGdeallocate_one(intlineno,char*name)
136+
ECPGdeallocate_one(intlineno,constchar*name)
137137
{
138138
structprepared_statement*this,
139139
*prev;

‎src/interfaces/ecpg/include/ecpglib.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ boolECPGstatus(int, const char *);
4848
boolECPGsetcommit(int,constchar*,constchar*);
4949
boolECPGsetconn(int,constchar*);
5050
boolECPGconnect(int,int,constchar*,constchar*,constchar*,constchar*,int);
51-
boolECPGdo(int,int,int,constchar*,char*,...);
51+
boolECPGdo(int,int,int,constchar*,constchar*,...);
5252
boolECPGtrans(int,constchar*,constchar*);
5353
boolECPGdisconnect(int,constchar*);
54-
boolECPGprepare(int,char*,char*);
55-
boolECPGdeallocate(int,int,char*);
56-
boolECPGdeallocate_one(int,char*);
54+
boolECPGprepare(int,constchar*,constchar*);
55+
boolECPGdeallocate(int,int,constchar*);
56+
boolECPGdeallocate_one(int,constchar*);
5757
boolECPGdeallocate_all(int);
5858
char*ECPGprepared_statement(constchar*);
5959

@@ -75,10 +75,10 @@ boolECPGdeallocate_desc(int line, const char *name);
7575
boolECPGallocate_desc(intline,constchar*name);
7676
voidECPGraise(intline,intcode,constchar*sqlstate,constchar*str);
7777
voidECPGraise_backend(intline,PGresult*result,PGconn*conn,intcompat);
78-
boolECPGget_desc_header(int,char*,int*);
79-
boolECPGget_desc(int,char*,int,...);
80-
boolECPGset_desc_header(int,char*,int);
81-
boolECPGset_desc(int,char*,int,...);
78+
boolECPGget_desc_header(int,constchar*,int*);
79+
boolECPGget_desc(int,constchar*,int,...);
80+
boolECPGset_desc_header(int,constchar*,int);
81+
boolECPGset_desc(int,constchar*,int,...);
8282

8383
voidECPGset_noind_null(enumECPGttype,void*);
8484
boolECPGis_noind_null(enumECPGttype,void*);

‎src/interfaces/ecpg/preproc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1998-2005, PostgreSQL Global Development Group
66
#
7-
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.114 2005/03/14 17:27:50 momjian Exp $
7+
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.115 2005/11/30 12:49:49 meskes Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -14,7 +14,7 @@ top_builddir = ../../../..
1414
include$(top_builddir)/src/Makefile.global
1515

1616
MAJOR_VERSION= 4
17-
MINOR_VERSION=1
17+
MINOR_VERSION=2
1818
PATCHLEVEL=1
1919

2020
overrideCPPFLAGS := -I$(srcdir)/../include -I$(srcdir)$(CPPFLAGS)\

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp