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

Commit0754b39

Browse files
author
Michael Meskes
committed
Removed some unneeded variables and comparisons
1 parent7340793 commit0754b39

File tree

15 files changed

+52
-50
lines changed

15 files changed

+52
-50
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.82 2009/02/03 08:55:45 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.83 2009/05/20 16:13:18 meskes Exp $ */
22

33
/*
44
* The aim is to get a simpler inteface to the database routines.
@@ -1501,7 +1501,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
15011501
*/
15021502
if (statement_type==ECPGst_prepnormal)
15031503
{
1504-
if (!ecpg_auto_prepare(lineno,connection_name,compat,questionmarks,&prepname,query))
1504+
if (!ecpg_auto_prepare(lineno,connection_name,compat,&prepname,query))
15051505
return (false);
15061506

15071507
/*
@@ -1519,7 +1519,7 @@ ECPGdo(const int lineno, const int compat, const int force_indicator, const char
15191519
if (statement_type==ECPGst_execute)
15201520
{
15211521
/* if we have an EXECUTE command, only the name is send */
1522-
char*command=ecpg_prepared(stmt->command,con,lineno);
1522+
char*command=ecpg_prepared(stmt->command,con);
15231523

15241524
if (command)
15251525
{

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.34 2008/02/07 11:09:12 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/extern.h,v 1.35 2009/05/20 16:13:18 meskes Exp $ */
22

33
#ifndef_ECPG_LIB_EXTERN_H
44
#define_ECPG_LIB_EXTERN_H
@@ -143,10 +143,10 @@ boolecpg_store_input(const int, const bool, const struct variable *, char **,
143143
boolecpg_check_PQresult(PGresult*,int,PGconn*,enumCOMPAT_MODE);
144144
voidecpg_raise(intline,intcode,constchar*sqlstate,constchar*str);
145145
voidecpg_raise_backend(intline,PGresult*result,PGconn*conn,intcompat);
146-
char*ecpg_prepared(constchar*,structconnection*,int);
146+
char*ecpg_prepared(constchar*,structconnection*);
147147
boolecpg_deallocate_all_conn(intlineno,enumCOMPAT_MODEc,structconnection*conn);
148148
voidecpg_log(constchar*format,...);
149-
boolecpg_auto_prepare(int,constchar*,int,constint,char**,constchar*);
149+
boolecpg_auto_prepare(int,constchar*,constint,char**,constchar*);
150150
voidecpg_init_sqlca(structsqlca_t*sqlca);
151151

152152
/* SQLSTATE values generated or processed by ecpglib (intentionally

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.29 2008/05/16 15:20:03 petere Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v 1.30 2009/05/20 16:13:18 meskes Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
@@ -56,7 +56,7 @@ isvarchar(unsigned char c)
5656
}
5757

5858
staticbool
59-
replace_variables(char**text,intlineno,boolquestionmarks)
59+
replace_variables(char**text,intlineno)
6060
{
6161
boolstring= false;
6262
intcounter=1,
@@ -110,8 +110,9 @@ replace_variables(char **text, int lineno, bool questionmarks)
110110
}
111111

112112
/* handle the EXEC SQL PREPARE statement */
113+
/* questionmarks is not needed but remians in there for the time being to not change the API */
113114
bool
114-
ECPGprepare(intlineno,constchar*connection_name,constintquestionmarks,constchar*name,constchar*variable)
115+
ECPGprepare(intlineno,constchar*connection_name,constboolquestionmarks,constchar*name,constchar*variable)
115116
{
116117
structconnection*con;
117118
structstatement*stmt;
@@ -148,7 +149,7 @@ ECPGprepare(int lineno, const char *connection_name, const int questionmarks, co
148149
stmt->inlist=stmt->outlist=NULL;
149150

150151
/* if we have C variables in our statment replace them with '?' */
151-
replace_variables(&(stmt->command),lineno,questionmarks);
152+
replace_variables(&(stmt->command),lineno);
152153

153154
/* add prepared statement to our list */
154155
this->name= (char*)name;
@@ -290,7 +291,7 @@ ECPGdeallocate_all(int lineno, int compat, const char *connection_name)
290291
}
291292

292293
char*
293-
ecpg_prepared(constchar*name,structconnection*con,intlineno)
294+
ecpg_prepared(constchar*name,structconnection*con)
294295
{
295296
structprepared_statement*this;
296297

@@ -299,10 +300,11 @@ ecpg_prepared(const char *name, struct connection * con, int lineno)
299300
}
300301

301302
/* return the prepared statement */
303+
/* lineno is not used here, but kept in to not break API */
302304
char*
303305
ECPGprepared_statement(constchar*connection_name,constchar*name,intlineno)
304306
{
305-
returnecpg_prepared(name,ecpg_get_connection(connection_name),lineno);
307+
returnecpg_prepared(name,ecpg_get_connection(connection_name));
306308
}
307309

308310
/*
@@ -460,7 +462,7 @@ AddStmtToCache(int lineno,/* line # of statement*/
460462

461463
/* handle cache and preparation of statments in auto-prepare mode */
462464
bool
463-
ecpg_auto_prepare(intlineno,constchar*connection_name,intcompat,constintquestionmarks,char**name,constchar*query)
465+
ecpg_auto_prepare(intlineno,constchar*connection_name,intcompat,char**name,constchar*query)
464466
{
465467
intentNo;
466468

@@ -481,7 +483,7 @@ ecpg_auto_prepare(int lineno, const char *connection_name, int compat, const int
481483
*name= (char*)ecpg_alloc(STMTID_SIZE,lineno);
482484
sprintf(*name,"ecpg%d",nextStmtID++);
483485

484-
if (!ECPGprepare(lineno,connection_name,questionmarks,ecpg_strdup(*name,lineno),query))
486+
if (!ECPGprepare(lineno,connection_name,0,ecpg_strdup(*name,lineno),query))
485487
return (false);
486488
if (AddStmtToCache(lineno,*name,connection_name,compat,query)<0)
487489
return (false);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* this is a small part of c.h since we don't want to leak all postgres
33
* definitions into ecpg programs
4-
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.77 2008/05/16 15:20:04 petere Exp $
4+
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpglib.h,v 1.78 2009/05/20 16:13:18 meskes Exp $
55
*/
66

77
#ifndef_ECPGLIB_H
@@ -54,7 +54,7 @@ boolECPGconnect(int, int, const char *, const char *, const char *, const char
5454
boolECPGdo(constint,constint,constint,constchar*,constbool,constint,constchar*,...);
5555
boolECPGtrans(int,constchar*,constchar*);
5656
boolECPGdisconnect(int,constchar*);
57-
boolECPGprepare(int,constchar*,constint,constchar*,constchar*);
57+
boolECPGprepare(int,constchar*,constbool,constchar*,constchar*);
5858
boolECPGdeallocate(int,int,constchar*,constchar*);
5959
boolECPGdeallocate_all(int,int,constchar*);
6060
char*ECPGprepared_statement(constchar*,constchar*,int);

‎src/interfaces/ecpg/pgtypeslib/datetime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.35 2009/02/04 08:51:09 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/datetime.c,v 1.36 2009/05/20 16:13:18 meskes Exp $ */
22

33
#include"postgres_fe.h"
44

@@ -74,7 +74,7 @@ PGTYPESdate_from_asc(char *str, char **endptr)
7474
returnINT_MIN;
7575
}
7676

77-
if (ParseDateTime(str,lowstr,field,ftype,MAXDATEFIELDS,&nf,ptr)!=0||
77+
if (ParseDateTime(str,lowstr,field,ftype,&nf,ptr)!=0||
7878
DecodeDateTime(field,ftype,nf,&dtype,tm,&fsec,EuroDates)!=0)
7979
{
8080
errno=PGTYPES_DATE_BAD_DATE;

‎src/interfaces/ecpg/pgtypeslib/dt.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.41 2009/02/04 08:51:09 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt.h,v 1.42 2009/05/20 16:13:18 meskes Exp $ */
22

33
#ifndefDT_H
44
#defineDT_H
@@ -334,7 +334,7 @@ do { \
334334

335335
intDecodeTimeOnly(char**,int*,int,int*,structtm*,fsec_t*,int*);
336336
intDecodeInterval(char**,int*,int,int*,structtm*,fsec_t*);
337-
intDecodeTime(char*,int,int*,structtm*,fsec_t*);
337+
intDecodeTime(char*,int*,structtm*,fsec_t*);
338338
intEncodeTimeOnly(structtm*,fsec_t,int*,int,char*);
339339
intEncodeDateTime(structtm*,fsec_t,int*,char**,int,char*,bool);
340340
intEncodeInterval(structtm*,fsec_t,int,char*);
@@ -343,7 +343,7 @@ intDecodeUnits(int field, char *lowtoken, int *val);
343343
boolCheckDateTokenTables(void);
344344
intEncodeDateOnly(structtm*,int,char*,bool);
345345
intGetEpochTime(structtm*);
346-
intParseDateTime(char*,char*,char**,int*,int,int*,char**);
346+
intParseDateTime(char*,char*,char**,int*,int*,char**);
347347
intDecodeDateTime(char**,int*,int,int*,structtm*,fsec_t*,bool);
348348
voidj2date(int,int*,int*,int*);
349349
voidGetCurrentDateTime(structtm*);

‎src/interfaces/ecpg/pgtypeslib/dt_common.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.48 2009/03/22 01:12:32 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/dt_common.c,v 1.49 2009/05/20 16:13:18 meskes Exp $ */
22

33
#include"postgres_fe.h"
44

@@ -1132,7 +1132,7 @@ dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec)
11321132
*/
11331133
staticint
11341134
DecodeNumberField(intlen,char*str,intfmask,
1135-
int*tmask,structtm*tm,fsec_t*fsec,int*is2digits,boolEuroDates)
1135+
int*tmask,structtm*tm,fsec_t*fsec,int*is2digits)
11361136
{
11371137
char*cp;
11381138

@@ -1258,7 +1258,7 @@ DecodeNumber(int flen, char *str, int fmask,
12581258
*/
12591259
if (cp-str>2)
12601260
returnDecodeNumberField(flen,str, (fmask |DTK_DATE_M),
1261-
tmask,tm,fsec,is2digits,EuroDates);
1261+
tmask,tm,fsec,is2digits);
12621262

12631263
*fsec=strtod(cp,&cp);
12641264
if (*cp!='\0')
@@ -1476,7 +1476,7 @@ DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates)
14761476
*can be used to represent time spans.
14771477
*/
14781478
int
1479-
DecodeTime(char*str,intfmask,int*tmask,structtm*tm,fsec_t*fsec)
1479+
DecodeTime(char*str,int*tmask,structtm*tm,fsec_t*fsec)
14801480
{
14811481
char*cp;
14821482

@@ -1640,7 +1640,7 @@ DecodePosixTimezone(char *str, int *tzp)
16401640
*/
16411641
int
16421642
ParseDateTime(char*timestr,char*lowstr,
1643-
char**field,int*ftype,intmaxfields,int*numfields,char**endstr)
1643+
char**field,int*ftype,int*numfields,char**endstr)
16441644
{
16451645
intnf=0;
16461646
char*lp=lowstr;
@@ -1928,7 +1928,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
19281928
* time
19291929
*/
19301930
if ((ftype[i]=DecodeNumberField(strlen(field[i]),field[i],fmask,
1931-
&tmask,tm,fsec,&is2digits,EuroDates))<0)
1931+
&tmask,tm,fsec,&is2digits))<0)
19321932
return-1;
19331933

19341934
/*
@@ -1951,7 +1951,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
19511951
break;
19521952

19531953
caseDTK_TIME:
1954-
if (DecodeTime(field[i],fmask,&tmask,tm,fsec)!=0)
1954+
if (DecodeTime(field[i],&tmask,tm,fsec)!=0)
19551955
return-1;
19561956

19571957
/*
@@ -2116,7 +2116,7 @@ DecodeDateTime(char **field, int *ftype, int nf,
21162116
caseDTK_TIME:
21172117
/* previous field was "t" for ISO time */
21182118
if ((ftype[i]=DecodeNumberField(strlen(field[i]),field[i], (fmask |DTK_DATE_M),
2119-
&tmask,tm,fsec,&is2digits,EuroDates))<0)
2119+
&tmask,tm,fsec,&is2digits))<0)
21202120
return-1;
21212121

21222122
if (tmask!=DTK_TIME_M)
@@ -2154,13 +2154,13 @@ DecodeDateTime(char **field, int *ftype, int nf,
21542154
* Example: 20011223 or 040506
21552155
*/
21562156
if ((ftype[i]=DecodeNumberField(flen,field[i],fmask,
2157-
&tmask,tm,fsec,&is2digits,EuroDates))<0)
2157+
&tmask,tm,fsec,&is2digits))<0)
21582158
return-1;
21592159
}
21602160
elseif (flen>4)
21612161
{
21622162
if ((ftype[i]=DecodeNumberField(flen,field[i],fmask,
2163-
&tmask,tm,fsec,&is2digits,EuroDates))<0)
2163+
&tmask,tm,fsec,&is2digits))<0)
21642164
return-1;
21652165
}
21662166
/* otherwise it is a single date/time field... */
@@ -2580,10 +2580,10 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
25802580
intscan_type;
25812581

25822582
char*pstr,
2583-
*pfmt,
2584-
*tmp;
2585-
interr=1;
2586-
intj;
2583+
*pfmt,
2584+
*tmp;
2585+
interr=1;
2586+
intj;
25872587
structtmtm;
25882588

25892589
pfmt=fmt;
@@ -2908,7 +2908,7 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
29082908
pfmt++;
29092909
scan_type=PGTYPES_TYPE_UINT;
29102910
err=pgtypes_defmt_scan(&scan_val,scan_type,&pstr,pfmt);
2911-
if (scan_val.uint_val<0||scan_val.uint_val>53)
2911+
if (scan_val.uint_val>53)
29122912
err=1;
29132913
break;
29142914
case'V':
@@ -2922,14 +2922,14 @@ PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
29222922
pfmt++;
29232923
scan_type=PGTYPES_TYPE_UINT;
29242924
err=pgtypes_defmt_scan(&scan_val,scan_type,&pstr,pfmt);
2925-
if (scan_val.uint_val<0||scan_val.uint_val>6)
2925+
if (scan_val.uint_val>6)
29262926
err=1;
29272927
break;
29282928
case'W':
29292929
pfmt++;
29302930
scan_type=PGTYPES_TYPE_UINT;
29312931
err=pgtypes_defmt_scan(&scan_val,scan_type,&pstr,pfmt);
2932-
if (scan_val.uint_val<0||scan_val.uint_val>53)
2932+
if (scan_val.uint_val>53)
29332933
err=1;
29342934
break;
29352935
case'x':

‎src/interfaces/ecpg/pgtypeslib/interval.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/pgtypeslib/interval.c,v 1.39 2008/11/26 16:47:08 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/interval.c,v 1.40 2009/05/20 16:13:18 meskes Exp $ */
22

33
#include"postgres_fe.h"
44
#include<time.h>
@@ -362,7 +362,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/
362362
switch (ftype[i])
363363
{
364364
caseDTK_TIME:
365-
dterr=DecodeTime(field[i],fmask,/* range, */
365+
dterr=DecodeTime(field[i],/* range, */
366366
&tmask,tm,fsec);
367367
if (dterr)
368368
returndterr;
@@ -384,7 +384,7 @@ DecodeInterval(char **field, int *ftype, int nf, /*int range,*/
384384
* and signed year-month values.
385385
*/
386386
if (strchr(field[i]+1,':')!=NULL&&
387-
DecodeTime(field[i]+1,fmask,/* INTERVAL_FULL_RANGE, */
387+
DecodeTime(field[i]+1,/* INTERVAL_FULL_RANGE, */
388388
&tmask,tm,fsec)==0)
389389
{
390390
if (*field[i]=='-')
@@ -1096,7 +1096,7 @@ PGTYPESinterval_from_asc(char *str, char **endptr)
10961096
returnNULL;
10971097
}
10981098

1099-
if (ParseDateTime(str,lowstr,field,ftype,MAXDATEFIELDS,&nf,ptr)!=0||
1099+
if (ParseDateTime(str,lowstr,field,ftype,&nf,ptr)!=0||
11001100
(DecodeInterval(field,ftype,nf,&dtype,tm,&fsec)!=0&&
11011101
DecodeISO8601Interval(str,&dtype,tm,&fsec)!=0))
11021102
{

‎src/interfaces/ecpg/pgtypeslib/timestamp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.43 2009/02/04 08:51:10 meskes Exp $
2+
* $PostgreSQL: pgsql/src/interfaces/ecpg/pgtypeslib/timestamp.c,v 1.44 2009/05/20 16:13:18 meskes Exp $
33
*/
44
#include"postgres_fe.h"
55

@@ -302,7 +302,7 @@ PGTYPEStimestamp_from_asc(char *str, char **endptr)
302302
return (noresult);
303303
}
304304

305-
if (ParseDateTime(str,lowstr,field,ftype,MAXDATEFIELDS,&nf,ptr)!=0||
305+
if (ParseDateTime(str,lowstr,field,ftype,&nf,ptr)!=0||
306306
DecodeDateTime(field,ftype,nf,&dtype,tm,&fsec,0)!=0)
307307
{
308308
errno=PGTYPES_TS_BAD_TIMESTAMP;

‎src/interfaces/ecpg/test/expected/sql-code100.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ struct sqlca_t *ECPGget_sqlca(void);
9292

9393

9494

95-
intmain(intargc,char**argv)
95+
intmain()
9696
{/* exec sql begin declare section */
9797

9898

‎src/interfaces/ecpg/test/expected/thread-alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ if (sqlca.sqlcode < 0) sqlprint();}
185185
return0;
186186
}
187187

188-
intmain (intargc,char**argv)
188+
intmain ()
189189
{
190190
inti;
191191
#ifdefWIN32

‎src/interfaces/ecpg/test/expected/thread-descriptor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ if (sqlca.sqlcode < 0) sqlprint();
126126
return0;
127127
}
128128

129-
intmain (intargc,char**argv)
129+
intmain ()
130130
{
131131
#ifdefENABLE_THREAD_SAFETY
132132
inti;

‎src/interfaces/ecpg/test/sql/code100.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exec sql include sqlca;
44
exec sql include ../regression;
55

66

7-
int main(int argc, char **argv)
7+
int main()
88
{ exec sql begin declare section;
99
int index;
1010
exec sql end declare section;

‎src/interfaces/ecpg/test/thread/alloc.pgc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void* fn(void* arg)
5757
return 0;
5858
}
5959

60-
int main (int argc, char** argv)
60+
int main ()
6161
{
6262
int i;
6363
#ifdef WIN32

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp