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

Commitd41f510

Browse files
committed
ecpg: Clean up some const usage
1 parent8efb0bc commitd41f510

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,15 +1083,15 @@ ecpg_store_input(const int lineno, const bool force_indicator, const struct vari
10831083
}
10841084

10851085
staticvoid
1086-
free_params(constchar**paramValues,intnParams,boolprint,intlineno)
1086+
free_params(char**paramValues,intnParams,boolprint,intlineno)
10871087
{
10881088
intn;
10891089

10901090
for (n=0;n<nParams;n++)
10911091
{
10921092
if (print)
10931093
ecpg_log("free_params on line %d: parameter %d = %s\n",lineno,n+1,paramValues[n] ?paramValues[n] :"null");
1094-
ecpg_free((void*) (paramValues[n]));
1094+
ecpg_free(paramValues[n]);
10951095
}
10961096
ecpg_free(paramValues);
10971097
}
@@ -1138,7 +1138,7 @@ ecpg_execute(struct statement * stmt)
11381138
PGnotify*notify;
11391139
structvariable*var;
11401140
intdesc_counter=0;
1141-
constchar**paramValues=NULL;
1141+
char**paramValues=NULL;
11421142
intnParams=0;
11431143
intposition=0;
11441144
structsqlca_t*sqlca=ECPGget_sqlca();
@@ -1380,7 +1380,7 @@ ecpg_execute(struct statement * stmt)
13801380
else
13811381
{
13821382
nParams++;
1383-
if (!(paramValues= (constchar**)ecpg_realloc(paramValues,sizeof(constchar*)*nParams,stmt->lineno)))
1383+
if (!(paramValues= (char**)ecpg_realloc(paramValues,sizeof(char*)*nParams,stmt->lineno)))
13841384
{
13851385
ecpg_free(paramValues);
13861386
return false;
@@ -1441,7 +1441,7 @@ ecpg_execute(struct statement * stmt)
14411441
ecpg_log("ecpg_execute on line %d: query: %s; with %d parameter(s) on connection %s\n",stmt->lineno,stmt->command,nParams,stmt->connection->name);
14421442
if (stmt->statement_type==ECPGst_execute)
14431443
{
1444-
results=PQexecPrepared(stmt->connection->connection,stmt->name,nParams,paramValues,NULL,NULL,0);
1444+
results=PQexecPrepared(stmt->connection->connection,stmt->name,nParams,(constchar*const*)paramValues,NULL,NULL,0);
14451445
ecpg_log("ecpg_execute on line %d: using PQexecPrepared for \"%s\"\n",stmt->lineno,stmt->command);
14461446
}
14471447
else
@@ -1453,7 +1453,7 @@ ecpg_execute(struct statement * stmt)
14531453
}
14541454
else
14551455
{
1456-
results=PQexecParams(stmt->connection->connection,stmt->command,nParams,NULL,paramValues,NULL,NULL,0);
1456+
results=PQexecParams(stmt->connection->connection,stmt->command,nParams,NULL,(constchar*const*)paramValues,NULL,NULL,0);
14571457
ecpg_log("ecpg_execute on line %d: using PQexecParams\n",stmt->lineno);
14581458
}
14591459
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct
1919
charstmtID[STMTID_SIZE];
2020
char*ecpgQuery;
2121
longexecs;/* # of executions*/
22-
char*connection;/* connection for the statement*/
22+
constchar*connection;/* connection for the statement*/
2323
}stmtCacheEntry;
2424

2525
staticintnextStmtID=1;
@@ -456,7 +456,7 @@ AddStmtToCache(int lineno,/* line # of statement*/
456456
entry=&stmtCacheEntries[entNo];
457457
entry->lineno=lineno;
458458
entry->ecpgQuery=ecpg_strdup(ecpgQuery,lineno);
459-
entry->connection=(char*)connection;
459+
entry->connection=connection;
460460
entry->execs=0;
461461
memcpy(entry->stmtID,stmtID,sizeof(entry->stmtID));
462462

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,14 @@ struct variable *
317317
descriptor_variable(constchar*name,intinput)
318318
{
319319
staticchardescriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
320-
staticconststructECPGtypedescriptor_type= {ECPGt_descriptor,NULL,NULL,NULL, {NULL},0};
321-
staticconststructvariablevarspace[2]= {
322-
{descriptor_names[0],(structECPGtype*)&descriptor_type,0,NULL},
323-
{descriptor_names[1],(structECPGtype*)&descriptor_type,0,NULL}
320+
staticstructECPGtypedescriptor_type= {ECPGt_descriptor,NULL,NULL,NULL, {NULL},0};
321+
staticstructvariablevarspace[2]= {
322+
{descriptor_names[0],&descriptor_type,0,NULL},
323+
{descriptor_names[1],&descriptor_type,0,NULL}
324324
};
325325

326326
strlcpy(descriptor_names[input],name,sizeof(descriptor_names[input]));
327-
return(structvariable*)&varspace[input];
327+
return&varspace[input];
328328
}
329329

330330
structvariable*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp