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
309a04f5
Commit
309a04f5
authored
Oct 25, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing "do { ... } while(0)" in ODBC macros and add find_baddefs
script.
parent
8b4d5c75
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
12 deletions
+36
-12
src/interfaces/odbc/convert.c
src/interfaces/odbc/convert.c
+17
-12
src/tools/find_baddefs
src/tools/find_baddefs
+19
-0
No files found.
src/interfaces/odbc/convert.c
View file @
309a04f5
...
@@ -796,7 +796,7 @@ static int enlarge_statement(StatementClass *stmt, unsigned int newsize)
...
@@ -796,7 +796,7 @@ static int enlarge_statement(StatementClass *stmt, unsigned int newsize)
*----------
*----------
*/
*/
#define CVT_INIT(size) \
#define CVT_INIT(size) \
{ \
do
{ \
if (stmt->stmt_with_params) \
if (stmt->stmt_with_params) \
free(stmt->stmt_with_params); \
free(stmt->stmt_with_params); \
if (stmt->stmt_size_limit > 0) \
if (stmt->stmt_size_limit > 0) \
...
@@ -811,7 +811,8 @@ static int enlarge_statement(StatementClass *stmt, unsigned int newsize)
...
@@ -811,7 +811,8 @@ static int enlarge_statement(StatementClass *stmt, unsigned int newsize)
stmt->stmt_with_params = new_statement; \
stmt->stmt_with_params = new_statement; \
npos = 0; \
npos = 0; \
new_statement[0] = '\0'; \
new_statement[0] = '\0'; \
}
} while (0)
/*----------
/*----------
* Terminate the stmt_with_params string with NULL.
* Terminate the stmt_with_params string with NULL.
*----------
*----------
...
@@ -823,55 +824,59 @@ static int enlarge_statement(StatementClass *stmt, unsigned int newsize)
...
@@ -823,55 +824,59 @@ static int enlarge_statement(StatementClass *stmt, unsigned int newsize)
*----------
*----------
*/
*/
#define CVT_APPEND_DATA(s, len) \
#define CVT_APPEND_DATA(s, len) \
{ \
do
{ \
unsigned int newpos = npos + len; \
unsigned int newpos = npos + len; \
ENLARGE_NEWSTATEMENT(newpos) \
ENLARGE_NEWSTATEMENT(newpos) \
memcpy(&new_statement[npos], s, len); \
memcpy(&new_statement[npos], s, len); \
npos = newpos; \
npos = newpos; \
new_statement[npos] = '\0'; \
new_statement[npos] = '\0'; \
}
} while (0)
/*----------
/*----------
* Append a string.
* Append a string.
*----------
*----------
*/
*/
#define CVT_APPEND_STR(s) \
#define CVT_APPEND_STR(s) \
{ \
do
{ \
unsigned int len = strlen(s); \
unsigned int len = strlen(s); \
CVT_APPEND_DATA(s, len); \
CVT_APPEND_DATA(s, len); \
}
} while (0)
/*----------
/*----------
* Append a char.
* Append a char.
*----------
*----------
*/
*/
#define CVT_APPEND_CHAR(c) \
#define CVT_APPEND_CHAR(c) \
{ \
do
{ \
ENLARGE_NEWSTATEMENT(npos + 1); \
ENLARGE_NEWSTATEMENT(npos + 1); \
new_statement[npos++] = c; \
new_statement[npos++] = c; \
}
} while (0)
/*----------
/*----------
* Append a binary data.
* Append a binary data.
* Newly reqeuired size may be overestimated currently.
* Newly reqeuired size may be overestimated currently.
*----------
*----------
*/
*/
#define CVT_APPEND_BINARY(buf, used) \
#define CVT_APPEND_BINARY(buf, used) \
{ \
do
{ \
unsigned int newlimit = npos + 5 * used; \
unsigned int newlimit = npos + 5 * used; \
ENLARGE_NEWSTATEMENT(newlimit); \
ENLARGE_NEWSTATEMENT(newlimit); \
npos += convert_to_pgbinary(buf, &new_statement[npos], used); \
npos += convert_to_pgbinary(buf, &new_statement[npos], used); \
}
} while (0)
/*----------
/*----------
*
*
*----------
*----------
*/
*/
#define CVT_SPECIAL_CHARS(buf, used) \
#define CVT_SPECIAL_CHARS(buf, used) \
{ \
do
{ \
int cnvlen = convert_special_chars(buf, NULL, used); \
int cnvlen = convert_special_chars(buf, NULL, used); \
unsigned int newlimit = npos + cnvlen; \
unsigned int newlimit = npos + cnvlen; \
\
\
ENLARGE_NEWSTATEMENT(newlimit); \
ENLARGE_NEWSTATEMENT(newlimit); \
convert_special_chars(buf, &new_statement[npos], used); \
convert_special_chars(buf, &new_statement[npos], used); \
npos += cnvlen; \
npos += cnvlen; \
}
}
while (0)
/*----------
/*----------
* Check if the statement is
* Check if the statement is
...
...
src/tools/find_baddefs
0 → 100755
View file @
309a04f5
#!/bin/sh
# This script attempts to find bad ifdef's, i.e. ifdef's that use braces
# but not the do { ... } while (0) syntax
#
# This is useful for running before pgindent
for
FILE
do
awk
' BEGIN {was_define = "N"}
{ if (was_define == "Y" &&
$0 ~ /^{/)
printf "%s %d\n", FILENAME, NR
if ($0 ~ /^#define/)
was_define = "Y"
else
was_define = "N"
}'
$FILE
done
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