Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d5ab9df7
Commit
d5ab9df7
authored
Jun 06, 2019
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary casts from size_t to int
We can use the %zu format specifier directly, no need to cast to int.
parent
6a1cd8b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
src/interfaces/ecpg/preproc/ecpg.addons
src/interfaces/ecpg/preproc/ecpg.addons
+2
-2
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/preproc/ecpg.trailer
+6
-6
No files found.
src/interfaces/ecpg/preproc/ecpg.addons
View file @
d5ab9df7
...
@@ -36,7 +36,7 @@ ECPG: stmtExecuteStmt block
...
@@ -36,7 +36,7 @@ ECPG: stmtExecuteStmt block
/* It must be cut off double quotation because new_variable() double-quotes. */
/* It must be cut off double quotation because new_variable() double-quotes. */
str[strlen(str) - 1] = '\0';
str[strlen(str) - 1] = '\0';
sprintf(length, "%
d", (int)
strlen(str));
sprintf(length, "%
zu",
strlen(str));
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
}
output_statement(cat_str(3, mm_strdup("execute"), mm_strdup("$0"), $1.type), 0, ECPGst_exec_with_exprlist);
output_statement(cat_str(3, mm_strdup("execute"), mm_strdup("$0"), $1.type), 0, ECPGst_exec_with_exprlist);
...
@@ -63,7 +63,7 @@ ECPG: stmtPrepareStmt block
...
@@ -63,7 +63,7 @@ ECPG: stmtPrepareStmt block
/* It must be cut off double quotation because new_variable() double-quotes. */
/* It must be cut off double quotation because new_variable() double-quotes. */
str[strlen(str) - 1] = '\0';
str[strlen(str) - 1] = '\0';
sprintf(length, "%
d", (int)
strlen(str));
sprintf(length, "%
zu",
strlen(str));
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
}
output_statement(cat_str(5, mm_strdup("prepare"), mm_strdup("$0"), $1.type, mm_strdup("as"), $1.stmt), 0, ECPGst_prepare);
output_statement(cat_str(5, mm_strdup("prepare"), mm_strdup("$0"), $1.type, mm_strdup("as"), $1.stmt), 0, ECPGst_prepare);
...
...
src/interfaces/ecpg/preproc/ecpg.trailer
View file @
d5ab9df7
...
@@ -1099,7 +1099,7 @@ UsingValue: UsingConst
...
@@ -1099,7 +1099,7 @@ UsingValue: UsingConst
{
{
char *length = mm_alloc(32);
char *length = mm_alloc(32);
sprintf(length, "%
d", (int)
strlen($1));
sprintf(length, "%
zu",
strlen($1));
add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
add_variable_to_head(&argsinsert, new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
}
}
| civar { $$ = EMPTY; }
| civar { $$ = EMPTY; }
...
@@ -1226,7 +1226,7 @@ IntConstVar: Iconst
...
@@ -1226,7 +1226,7 @@ IntConstVar: Iconst
{
{
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(length, "%
d", (int)
strlen($1));
sprintf(length, "%
zu",
strlen($1));
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = $1;
$$ = $1;
}
}
...
@@ -1272,7 +1272,7 @@ AllConstVar: ecpg_fconst
...
@@ -1272,7 +1272,7 @@ AllConstVar: ecpg_fconst
{
{
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
sprintf(length, "%
d", (int)
strlen($1));
sprintf(length, "%
zu",
strlen($1));
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = $1;
$$ = $1;
}
}
...
@@ -1287,7 +1287,7 @@ AllConstVar: ecpg_fconst
...
@@ -1287,7 +1287,7 @@ AllConstVar: ecpg_fconst
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(mm_strdup("-"), $2);
char *var = cat2_str(mm_strdup("-"), $2);
sprintf(length, "%
d", (int)
strlen(var));
sprintf(length, "%
zu",
strlen(var));
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
$$ = var;
}
}
...
@@ -1297,7 +1297,7 @@ AllConstVar: ecpg_fconst
...
@@ -1297,7 +1297,7 @@ AllConstVar: ecpg_fconst
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
char *var = cat2_str(mm_strdup("-"), $2);
char *var = cat2_str(mm_strdup("-"), $2);
sprintf(length, "%
d", (int)
strlen(var));
sprintf(length, "%
zu",
strlen(var));
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
$$ = var;
}
}
...
@@ -1308,7 +1308,7 @@ AllConstVar: ecpg_fconst
...
@@ -1308,7 +1308,7 @@ AllConstVar: ecpg_fconst
char *var = $1 + 1;
char *var = $1 + 1;
var[strlen(var) - 1] = '\0';
var[strlen(var) - 1] = '\0';
sprintf(length, "%
d", (int)
strlen(var));
sprintf(length, "%
zu",
strlen(var));
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
$$ = var;
$$ = var;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment