diff options
| author | Bruce Momjian | 2001-10-25 01:29:37 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2001-10-25 01:29:37 +0000 |
| commit | fde8edaf53806777e606e04187d60d5b3f26d886 (patch) | |
| tree | a9d2702cbf8a0748931c81c27aa48dda4293c973 /src/interfaces/odbc | |
| parent | b4a57b06486df001e9b4e4350c493e2c15e76380 (diff) | |
Add do { ... } while (0) to more bad macros.
Diffstat (limited to 'src/interfaces/odbc')
| -rw-r--r-- | src/interfaces/odbc/convert.c | 9 | ||||
| -rw-r--r-- | src/interfaces/odbc/iodbc.h | 6 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c index 6210d030bf0..2afc079dfd8 100644 --- a/src/interfaces/odbc/convert.c +++ b/src/interfaces/odbc/convert.c @@ -817,7 +817,10 @@ do { \ * Terminate the stmt_with_params string with NULL. *---------- */ -#define CVT_TERMINATE { new_statement[npos] = '\0'; } +#define CVT_TERMINATE \ +do { \ + new_statement[npos] = '\0'; \ +} while (0) /*---------- * Append a data. @@ -1434,7 +1437,7 @@ copy_statement_with_parameters(StatementClass *stmt) /* error */ stmt->errormsg = "Unrecognized C_parameter type in copy_statement_with_parameters"; stmt->errornumber = STMT_NOT_IMPLEMENTED_ERROR; - CVT_TERMINATE /* just in case */ + CVT_TERMINATE; /* just in case */ SC_log_error(func, "", stmt); return SQL_ERROR; } @@ -1684,7 +1687,7 @@ copy_statement_with_parameters(StatementClass *stmt) } /* end, for */ /* make sure new_statement is always null-terminated */ - CVT_TERMINATE + CVT_TERMINATE; if (conn->DriverToDataSource != NULL) { diff --git a/src/interfaces/odbc/iodbc.h b/src/interfaces/odbc/iodbc.h index 21091de90f9..99ed5520550 100644 --- a/src/interfaces/odbc/iodbc.h +++ b/src/interfaces/odbc/iodbc.h @@ -8,7 +8,11 @@ #include <sys/types.h> #define MEM_ALLOC(size) (malloc((size_t)(size))) -#define MEM_FREE(ptr) {if(ptr) free(ptr);} +#define MEM_FREE(ptr) \ +do { \ + if(ptr) \ + free(ptr); \ +} while (0) #define STRCPY(t, s) (strcpy((char*)(t), (char*)(s))) #define STRNCPY(t,s,n) (strncpy((char*)(t), (char*)(s), (size_t)(n))) |
