pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedOptimize the function names variable
2+ messages / 2 participants
[nested] [flat]
* Optimize the function names variable
@ 2003-08-21 10:36 Shachar Shemesh <psql@shemesh.biz>
2003-08-22 14:02 ` Re: Optimize the function names variable Hiroshi Inoue <inoue@tpf.co.jp>
0 siblings, 1 reply; 2+ messages in thread
From: Shachar Shemesh @ 2003-08-21 10:36 UTC (permalink / raw)
To: pgsql-odbc
Hi all,
The attached patch changes the storage type of the debug "func" variables to be
stored in the constant area of the program, and not store the pointers in memory
by making them static and const.
Not overly important in the grand scheme of things, but useful.
Shachar
Attachments:
stringopt.diff (application/octet-stream, 28.3K) download
Index: bind.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/bind.c,v
retrieving revision 1.46
diff -u -r1.46 bind.c
--- bind.c 30 May 2003 02:30:33 -0000 1.46
+++ bind.c 21 Aug 2003 10:30:38 -0000
@@ -41,7 +41,7 @@
SDWORD FAR * pcbValue)
{
StatementClass *stmt = (StatementClass *) hstmt;
- static char *func = "PGAPI_BindParameter";
+ CSTR func = "PGAPI_BindParameter";
APDFields *apdopts;
IPDFields *ipdopts;
@@ -141,7 +141,7 @@
SDWORD FAR * pcbValue)
{
StatementClass *stmt = (StatementClass *) hstmt;
- static char *func = "PGAPI_BindCol";
+ CSTR func = "PGAPI_BindCol";
ARDFields *opts;
mylog("%s: entering...\n", func);
@@ -276,7 +276,7 @@
SWORD FAR * pfNullable)
{
StatementClass *stmt = (StatementClass *) hstmt;
- static char *func = "PGAPI_DescribeParam";
+ CSTR func = "PGAPI_DescribeParam";
APDFields *apdopts;
IPDFields *ipdopts;
@@ -328,7 +328,7 @@
UDWORD crow,
UDWORD FAR * pirow)
{
- static char *func = "PGAPI_ParamOptions";
+ CSTR func = "PGAPI_ParamOptions";
StatementClass *stmt = (StatementClass *) hstmt;
APDFields *apdopts;
@@ -358,7 +358,7 @@
StatementClass *stmt = (StatementClass *) hstmt;
char in_quote = FALSE;
unsigned int i;
- static char *func = "PGAPI_NumParams";
+ CSTR func = "PGAPI_NumParams";
mylog("%s: entering...\n", func);
@@ -431,7 +431,7 @@
void
extend_parameter_bindings(APDFields *self, int num_params)
{
- static char *func = "extend_parameter_bindings";
+ CSTR func = "extend_parameter_bindings";
ParameterInfoClass *new_bindings;
mylog("%s: entering ... self=%u, parameters_allocated=%d, num_params=%d\n", func, self, self->allocated, num_params);
@@ -464,7 +464,7 @@
void
extend_iparameter_bindings(IPDFields *self, int num_params)
{
- static char *func = "extend_iparameter_bindings";
+ CSTR func = "extend_iparameter_bindings";
ParameterImplClass *new_bindings;
mylog("%s: entering ... self=%u, parameters_allocated=%d, num_params=%d\n", func, self, self->allocated, num_params);
@@ -497,7 +497,7 @@
void
reset_a_parameter_binding(APDFields *self, int ipar)
{
- static char *func = "reset_a_parameter_binding";
+ CSTR func = "reset_a_parameter_binding";
mylog("%s: entering ... self=%u, parameters_allocated=%d, ipar=%d\n", func, self, self->allocated, ipar);
@@ -530,7 +530,7 @@
void
reset_a_iparameter_binding(IPDFields *self, int ipar)
{
- static char *func = "reset_a_iparameter_binding";
+ CSTR func = "reset_a_iparameter_binding";
mylog("%s: entering ... self=%u, parameters_allocated=%d, ipar=%d\n", func, self, self->allocated, ipar);
@@ -610,7 +610,7 @@
void
extend_column_bindings(ARDFields *self, int num_columns)
{
- static char *func = "extend_column_bindings";
+ CSTR func = "extend_column_bindings";
BindInfoClass *new_bindings;
int i;
@@ -664,7 +664,7 @@
void
reset_a_column_binding(ARDFields *self, int icol)
{
- static char *func = "reset_a_column_binding";
+ CSTR func = "reset_a_column_binding";
mylog("%s: entering ... self=%u, bindings_allocated=%d, icol=%d\n", func, self, self->allocated, icol);
Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/connection.c,v
retrieving revision 1.79
diff -u -r1.79 connection.c
--- connection.c 12 May 2003 15:44:08 -0000 1.79
+++ connection.c 21 Aug 2003 10:30:39 -0000
@@ -50,7 +50,7 @@
{
EnvironmentClass *env = (EnvironmentClass *) henv;
ConnectionClass *conn;
- static char *func = "PGAPI_AllocConnect";
+ CSTR func = "PGAPI_AllocConnect";
mylog("%s: entering...\n", func);
@@ -95,7 +95,7 @@
{
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci;
- static char *func = "PGAPI_Connect";
+ CSTR func = "PGAPI_Connect";
mylog("%s: entering...\n", func);
@@ -150,7 +150,7 @@
SWORD cbConnStrOutMax,
SWORD FAR * pcbConnStrOut)
{
- static char *func = "PGAPI_BrowseConnect";
+ CSTR func = "PGAPI_BrowseConnect";
mylog("%s: entering...\n", func);
@@ -164,7 +164,7 @@
HDBC hdbc)
{
ConnectionClass *conn = (ConnectionClass *) hdbc;
- static char *func = "PGAPI_Disconnect";
+ CSTR func = "PGAPI_Disconnect";
mylog("%s: entering...\n", func);
@@ -202,7 +202,7 @@
HDBC hdbc)
{
ConnectionClass *conn = (ConnectionClass *) hdbc;
- static char *func = "PGAPI_FreeConnect";
+ CSTR func = "PGAPI_FreeConnect";
mylog("%s: entering...\n", func);
mylog("**** in %s: hdbc=%u\n", func, hdbc);
@@ -623,7 +623,7 @@
int beresp;
char msgbuffer[ERROR_MSG_LENGTH];
char salt[5], notice[512];
- static char *func = "CC_connect";
+ CSTR func = "CC_connect";
char *encoding;
mylog("%s: entering...\n", func);
@@ -1786,7 +1786,7 @@
#ifdef HAVE_STRTOK_R
char *last;
#endif /* HAVE_STRTOK_R */
- static char *func = "CC_send_settings";
+ CSTR func = "CC_send_settings";
mylog("%s: entering...\n", func);
@@ -1915,7 +1915,7 @@
HSTMT hstmt;
StatementClass *stmt;
RETCODE result;
- static char *func = "CC_lookup_lo";
+ CSTR func = "CC_lookup_lo";
mylog("%s: entering...\n", func);
@@ -2000,7 +2000,7 @@
char szVersion[32];
int major,
minor;
- static char *func = "CC_lookup_pg_version";
+ CSTR func = "CC_lookup_pg_version";
mylog("%s: entering...\n", func);
Index: convert.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/convert.c,v
retrieving revision 1.103
diff -u -r1.103 convert.c
--- convert.c 18 Jun 2003 13:24:23 -0000 1.103
+++ convert.c 21 Aug 2003 10:30:41 -0000
@@ -365,7 +365,7 @@
copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2 fCType,
PTR rgbValue, SDWORD cbValueMax, SDWORD *pcbValue)
{
- static char *func = "copy_and_convert_field";
+ CSTR func = "copy_and_convert_field";
ARDFields *opts = SC_get_ARD(stmt);
Int4 len = 0,
copy_len = 0;
@@ -1558,7 +1558,7 @@
enlarge_query_statement(QueryBuild *qb, unsigned int newsize)
{
unsigned int newalsize = INIT_MIN_ALLOC;
- static char *func = "enlarge_statement";
+ CSTR func = "enlarge_statement";
if (qb->str_size_limit > 0 && qb->str_size_limit < (int) newsize)
{
@@ -1773,7 +1773,7 @@
static int
Prepare_and_convert(StatementClass *stmt, QueryParse *qp, QueryBuild *qb)
{
- const static char *func = "Prepare_and_convert";
+ CSTR func = "Prepare_and_convert";
char *new_statement, *exe_statement = NULL;
int retval;
@@ -1880,7 +1880,7 @@
int
copy_statement_with_parameters(StatementClass *stmt, BOOL buildPrepareStatement)
{
- static char *func = "copy_statement_with_parameters";
+ CSTR func = "copy_statement_with_parameters";
RETCODE retval;
QueryParse query_org, *qp;
QueryBuild query_crt, *qb;
@@ -2084,7 +2084,7 @@
static int
inner_process_tokens(QueryParse *qp, QueryBuild *qb)
{
- static char *func = "inner_process_tokens";
+ CSTR func = "inner_process_tokens";
BOOL lf_conv = qb->lf_conv;
RETCODE retval;
@@ -2397,7 +2397,7 @@
static int
ResolveOneParam(QueryBuild *qb)
{
- const char *func = "ResolveOneParam";
+ CSTR func = "ResolveOneParam";
ConnectionClass *conn = qb->conn;
ConnInfo *ci = &(conn->connInfo);
@@ -2997,7 +2997,7 @@
processParameters(QueryParse *qp, QueryBuild *qb,
UInt4 *output_count, Int4 param_pos[][2])
{
- static const char *func = "processParameters";
+ CSTR func = "processParameters";
int retval, innerParenthesis, param_count;
BOOL stop;
@@ -3092,7 +3092,7 @@
static int
convert_escape(QueryParse *qp, QueryBuild *qb)
{
- static const char *func = "convert_escape";
+ CSTR func = "convert_escape";
RETCODE retval = SQL_SUCCESS;
char buf[1024], buf_small[128], key[65];
unsigned char ucv;
Index: drvconn.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/drvconn.c,v
retrieving revision 1.43
diff -u -r1.43 drvconn.c
--- drvconn.c 20 May 2003 14:10:47 -0000 1.43
+++ drvconn.c 21 Aug 2003 10:30:41 -0000
@@ -87,7 +87,7 @@
SWORD FAR * pcbConnStrOut,
UWORD fDriverCompletion)
{
- static char *func = "PGAPI_DriverConnect";
+ CSTR func = "PGAPI_DriverConnect";
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci;
Index: environ.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/environ.c,v
retrieving revision 1.48
diff -u -r1.48 environ.c
--- environ.c 11 Jul 2003 10:47:17 -0000 1.48
+++ environ.c 21 Aug 2003 10:30:42 -0000
@@ -36,7 +36,7 @@
RETCODE SQL_API
PGAPI_AllocEnv(HENV FAR * phenv)
{
- static char *func = "PGAPI_AllocEnv";
+ CSTR func = "PGAPI_AllocEnv";
mylog("**** in PGAPI_AllocEnv ** \n");
@@ -66,7 +66,7 @@
RETCODE SQL_API
PGAPI_FreeEnv(HENV henv)
{
- static char *func = "PGAPI_FreeEnv";
+ CSTR func = "PGAPI_FreeEnv";
EnvironmentClass *env = (EnvironmentClass *) henv;
mylog("**** in PGAPI_FreeEnv: env = %u ** \n", env);
@@ -672,7 +672,7 @@
void
-EN_log_error(char *func, char *desc, EnvironmentClass *self)
+EN_log_error(const char *func, char *desc, EnvironmentClass *self)
{
if (self)
qlog("ENVIRON ERROR: func=%s, desc='%s', errnum=%d, errmsg='%s'\n", func, desc, self->errornumber, self->errormsg);
Index: environ.h
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/environ.h,v
retrieving revision 1.19
diff -u -r1.19 environ.h
--- environ.h 16 Dec 2002 15:01:33 -0000 1.19
+++ environ.h 21 Aug 2003 10:30:42 -0000
@@ -36,7 +36,7 @@
char EN_get_error(EnvironmentClass *self, int *number, char **message);
char EN_add_connection(EnvironmentClass *self, ConnectionClass *conn);
char EN_remove_connection(EnvironmentClass *self, ConnectionClass *conn);
-void EN_log_error(char *func, char *desc, EnvironmentClass *self);
+void EN_log_error(const char *func, char *desc, EnvironmentClass *self);
#define EN_OV_ODBC2 1L
#define EN_CONN_POOLING (1L<<1)
Index: execute.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/execute.c,v
retrieving revision 1.53
diff -u -r1.53 execute.c
--- execute.c 23 Apr 2003 09:49:47 -0000 1.53
+++ execute.c 21 Aug 2003 10:30:42 -0000
@@ -36,7 +36,7 @@
UCHAR FAR * szSqlStr,
SDWORD cbSqlStr)
{
- static char *func = "PGAPI_Prepare";
+ CSTR func = "PGAPI_Prepare";
StatementClass *self = (StatementClass *) hstmt;
mylog("%s: entering...\n", func);
@@ -134,7 +134,7 @@
{
StatementClass *stmt = (StatementClass *) hstmt;
RETCODE result;
- static char *func = "PGAPI_ExecDirect";
+ CSTR func = "PGAPI_ExecDirect";
mylog("%s: entering...\n", func);
@@ -195,7 +195,7 @@
static
RETCODE Exec_with_parameters_resolved(StatementClass *stmt, BOOL *exec_end)
{
- static const char *func = "Exec_with_parameters_resolved";
+ CSTR func = "Exec_with_parameters_resolved";
RETCODE retval;
int end_row, cursor_type, scroll_concurrency;
ConnectionClass *conn;
@@ -374,7 +374,7 @@
PGAPI_Execute(
HSTMT hstmt)
{
- static char *func = "PGAPI_Execute";
+ CSTR func = "PGAPI_Execute";
StatementClass *stmt = (StatementClass *) hstmt;
APDFields *apdopts;
IPDFields *ipdopts;
@@ -606,7 +606,7 @@
HDBC hdbc,
UWORD fType)
{
- static char *func = "PGAPI_Transact";
+ CSTR func = "PGAPI_Transact";
extern ConnectionClass *conns[];
ConnectionClass *conn;
QResultClass *res;
@@ -684,7 +684,7 @@
PGAPI_Cancel(
HSTMT hstmt) /* Statement to cancel. */
{
- static char *func = "PGAPI_Cancel";
+ CSTR func = "PGAPI_Cancel";
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn;
RETCODE result;
@@ -775,7 +775,7 @@
SDWORD cbSqlStrMax,
SDWORD FAR * pcbSqlStr)
{
- static char *func = "PGAPI_NativeSql";
+ CSTR func = "PGAPI_NativeSql";
int len = 0;
char *ptr;
ConnectionClass *conn = (ConnectionClass *) hdbc;
@@ -824,7 +824,7 @@
HSTMT hstmt,
PTR FAR * prgbValue)
{
- static char *func = "PGAPI_ParamData";
+ CSTR func = "PGAPI_ParamData";
StatementClass *stmt = (StatementClass *) hstmt;
APDFields *apdopts;
IPDFields *ipdopts;
@@ -921,7 +921,7 @@
PTR rgbValue,
SDWORD cbValue)
{
- static char *func = "PGAPI_PutData";
+ CSTR func = "PGAPI_PutData";
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn;
APDFields *apdopts;
Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/info.c,v
retrieving revision 1.99
diff -u -r1.99 info.c
--- info.c 30 Jun 2003 03:51:24 -0000 1.99
+++ info.c 21 Aug 2003 10:30:45 -0000
@@ -59,7 +59,7 @@
SWORD cbInfoValueMax,
SWORD FAR * pcbInfoValue)
{
- static char *func = "PGAPI_GetInfo";
+ CSTR func = "PGAPI_GetInfo";
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci;
char *p = NULL,
@@ -790,7 +790,7 @@
HSTMT hstmt,
SWORD fSqlType)
{
- static char *func = "PGAPI_GetTypeInfo";
+ CSTR func = "PGAPI_GetTypeInfo";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
TupleNode *row;
@@ -929,7 +929,7 @@
UWORD fFunction,
UWORD FAR * pfExists)
{
- static char *func = "PGAPI_GetFunctions";
+ CSTR func = "PGAPI_GetFunctions";
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci = &(conn->connInfo);
@@ -1285,7 +1285,7 @@
UCHAR FAR * szTableType,
SWORD cbTableType)
{
- static char *func = "PGAPI_Tables";
+ CSTR func = "PGAPI_Tables";
StatementClass *stmt = (StatementClass *) hstmt;
StatementClass *tbl_stmt;
QResultClass *res;
@@ -1705,7 +1705,7 @@
SWORD cbColumnName,
UWORD flag)
{
- static char *func = "PGAPI_Columns";
+ CSTR func = "PGAPI_Columns";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
TupleNode *row;
@@ -2242,7 +2242,7 @@
UWORD fScope,
UWORD fNullable)
{
- static char *func = "PGAPI_SpecialColumns";
+ CSTR func = "PGAPI_SpecialColumns";
TupleNode *row;
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn;
@@ -2461,7 +2461,7 @@
UWORD fUnique,
UWORD fAccuracy)
{
- static char *func = "PGAPI_Statistics";
+ CSTR func = "PGAPI_Statistics";
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn;
QResultClass *res;
@@ -2901,7 +2901,7 @@
UCHAR FAR * szColumnName,
SWORD cbColumnName)
{
- static char *func = "PGAPI_ColumnPrivileges";
+ CSTR func = "PGAPI_ColumnPrivileges";
StatementClass *stmt = (StatementClass *) hstmt;
mylog("%s: entering...\n", func);
@@ -2929,7 +2929,7 @@
UCHAR FAR * szTableName,
SWORD cbTableName)
{
- static char *func = "PGAPI_PrimaryKeys";
+ CSTR func = "PGAPI_PrimaryKeys";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
ConnectionClass *conn;
@@ -3410,7 +3410,7 @@
UCHAR FAR * szFkTableName,
SWORD cbFkTableName)
{
- static char *func = "PGAPI_ForeignKeys";
+ CSTR func = "PGAPI_ForeignKeys";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
TupleNode *row;
@@ -4262,7 +4262,7 @@
UCHAR FAR * szColumnName,
SWORD cbColumnName)
{
- static char *func = "PGAPI_ProcedureColumns";
+ CSTR func = "PGAPI_ProcedureColumns";
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn = SC_get_conn(stmt);
char proc_query[INFO_INQUIRY_LEN];
@@ -4450,7 +4450,7 @@
UCHAR FAR * szProcName,
SWORD cbProcName)
{
- static char *func = "PGAPI_Procedures";
+ CSTR func = "PGAPI_Procedures";
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn = SC_get_conn(stmt);
char proc_query[INFO_INQUIRY_LEN];
@@ -4573,7 +4573,7 @@
UWORD flag)
{
StatementClass *stmt = (StatementClass *) hstmt;
- static char *func = "PGAPI_TablePrivileges";
+ CSTR func = "PGAPI_TablePrivileges";
ConnectionClass *conn = SC_get_conn(stmt);
Int2 result_cols;
char proc_query[INFO_INQUIRY_LEN];
Index: info30.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/info30.c,v
retrieving revision 1.12
diff -u -r1.12 info30.c
--- info30.c 30 May 2003 02:30:33 -0000 1.12
+++ info30.c 21 Aug 2003 10:30:45 -0000
@@ -16,7 +16,7 @@
PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue,
SWORD cbInfoValueMax, SWORD FAR * pcbInfoValue)
{
- static char *func = "PGAPI_GetInfo30";
+ CSTR func = "PGAPI_GetInfo30";
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci = &(conn->connInfo);
char *p = NULL;
Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/misc.h,v
retrieving revision 1.38
diff -u -r1.38 misc.h
--- misc.h 23 Apr 2003 09:49:47 -0000 1.38
+++ misc.h 21 Aug 2003 10:30:45 -0000
@@ -133,5 +133,8 @@
#define STRCPY_NULL (-2)
int my_strcpy(char *dst, int dst_len, const char *src, int src_len);
+
+/* Define a type for defining a constant string expression */
+#define CSTR static const char * const
#endif
Index: multibyte.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/multibyte.c,v
retrieving revision 1.30
diff -u -r1.30 multibyte.c
--- multibyte.c 23 Apr 2003 09:49:47 -0000 1.30
+++ multibyte.c 21 Aug 2003 10:30:46 -0000
@@ -366,7 +366,7 @@
CC_lookup_characterset(ConnectionClass *self)
{
char *encstr;
- static char *func = "CC_lookup_characterset";
+ CSTR func = "CC_lookup_characterset";
mylog("%s: entering...\n", func);
if (PG_VERSION_LT(self, 7.2))
Index: odbcapi.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/odbcapi.c,v
retrieving revision 1.17
diff -u -r1.17 odbcapi.c
--- odbcapi.c 31 Jul 2003 01:57:50 -0000 1.17
+++ odbcapi.c 21 Aug 2003 10:30:46 -0000
@@ -288,7 +288,7 @@
RETCODE SQL_API
SQLFetch(HSTMT StatementHandle)
{
- static char *func = "SQLFetch";
+ CSTR func = "SQLFetch";
RETCODE ret;
StatementClass *stmt = (StatementClass *) StatementHandle;
Index: odbcapi30.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/odbcapi30.c,v
retrieving revision 1.25
diff -u -r1.25 odbcapi30.c
--- odbcapi30.c 31 Jul 2003 01:57:50 -0000 1.25
+++ odbcapi30.c 21 Aug 2003 10:30:47 -0000
@@ -196,7 +196,7 @@
SQLFetchScroll(HSTMT StatementHandle,
SQLSMALLINT FetchOrientation, SQLINTEGER FetchOffset)
{
- static char *func = "SQLFetchScroll";
+ CSTR func = "SQLFetchScroll";
StatementClass *stmt = (StatementClass *) StatementHandle;
RETCODE ret = SQL_SUCCESS;
IRDFields *irdopts = SC_get_IRD(stmt);
@@ -376,7 +376,7 @@
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
RETCODE ret;
- static char *func = "SQLGetStmtAttr";
+ CSTR func = "SQLGetStmtAttr";
mylog("[[%s]] Handle=%u %d\n", func, StatementHandle, Attribute);
ENTER_STMT_CS((StatementClass *) StatementHandle);
@@ -428,7 +428,7 @@
PTR Data, SQLINTEGER *StringLength,
SQLINTEGER *Indicator)
{
- const char *func = "SQLSetDescRec";
+ CSTR func = "SQLSetDescRec";
mylog("[[SQLSetDescRec]]\n");
mylog("Error not implemented\n");
@@ -502,7 +502,7 @@
SQLINTEGER Attribute, PTR Value,
SQLINTEGER StringLength)
{
- static char *func = "SQLSetStmtAttr";
+ CSTR func = "SQLSetStmtAttr";
StatementClass *stmt = (StatementClass *) StatementHandle;
RETCODE ret;
@@ -640,7 +640,7 @@
SQLBulkOperations(HSTMT hstmt, SQLSMALLINT operation)
{
RETCODE ret;
- static char *func = "SQLBulkOperations";
+ CSTR func = "SQLBulkOperations";
StatementClass *stmt = (StatementClass *) hstmt;
ENTER_STMT_CS(stmt);
Index: options.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/options.c,v
retrieving revision 1.50
diff -u -r1.50 options.c
--- options.c 31 Jul 2003 01:57:50 -0000 1.50
+++ options.c 21 Aug 2003 10:30:47 -0000
@@ -36,7 +36,7 @@
UWORD fOption,
UDWORD vParam)
{
- static char *func = "set_statement_option";
+ CSTR func = "set_statement_option";
char changed = FALSE;
ConnInfo *ci = NULL;
UDWORD setval;
@@ -305,7 +305,7 @@
UWORD fOption,
UDWORD vParam)
{
- static char *func = "PGAPI_SetConnectOption";
+ CSTR func = "PGAPI_SetConnectOption";
ConnectionClass *conn = (ConnectionClass *) hdbc;
char changed = FALSE;
RETCODE retval;
@@ -517,7 +517,7 @@
UWORD fOption,
PTR pvParam)
{
- static char *func = "PGAPI_GetConnectOption";
+ CSTR func = "PGAPI_GetConnectOption";
ConnectionClass *conn = (ConnectionClass *) hdbc;
ConnInfo *ci = &(conn->connInfo);
@@ -603,7 +603,7 @@
UWORD fOption,
UDWORD vParam)
{
- static char *func = "PGAPI_SetStmtOption";
+ CSTR func = "PGAPI_SetStmtOption";
StatementClass *stmt = (StatementClass *) hstmt;
mylog("%s: entering...\n", func);
@@ -629,7 +629,7 @@
UWORD fOption,
PTR pvParam)
{
- static char *func = "PGAPI_GetStmtOption";
+ CSTR func = "PGAPI_GetStmtOption";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
ConnInfo *ci = &(SC_get_conn(stmt)->connInfo);
Index: parse.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/parse.c,v
retrieving revision 1.43
diff -u -r1.43 parse.c
--- parse.c 9 Jul 2003 08:09:11 -0000 1.43
+++ parse.c 21 Aug 2003 10:30:48 -0000
@@ -320,7 +320,7 @@
char
parse_statement(StatementClass *stmt)
{
- static char *func = "parse_statement";
+ CSTR func = "parse_statement";
char token[256], stoken[256];
char delim,
quote,
Index: pgapi30.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/pgapi30.c,v
retrieving revision 1.16
diff -u -r1.16 pgapi30.c
--- pgapi30.c 31 Jul 2003 01:57:50 -0000 1.16
+++ pgapi30.c 21 Aug 2003 10:30:49 -0000
@@ -36,7 +36,7 @@
SQLSMALLINT BufferLength, SQLSMALLINT *TextLength)
{
RETCODE ret;
- static const char *func = "PGAPI_GetDiagRec";
+ CSTR func = "PGAPI_GetDiagRec";
mylog("%s entering rec=%d", func, RecNumber);
switch (HandleType)
@@ -85,7 +85,7 @@
StatementClass *stmt;
SDWORD rc;
SWORD pcbErrm;
- static const char *func = "PGAPI_GetDiagField";
+ CSTR func = "PGAPI_GetDiagField";
mylog("%s entering rec=%d", func, RecNumber);
switch (HandleType)
@@ -362,7 +362,7 @@
SQLINTEGER Attribute, PTR Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
- static const char *func = "PGAPI_GetConnectAttr";
+ CSTR func = "PGAPI_GetConnectAttr";
ConnectionClass *conn = (ConnectionClass *) ConnectionHandle;
RETCODE ret = SQL_SUCCESS;
SQLINTEGER len = 4;
@@ -1409,7 +1409,7 @@
SQLINTEGER Attribute, PTR Value,
SQLINTEGER BufferLength, SQLINTEGER *StringLength)
{
- static char *func = "PGAPI_GetStmtAttr";
+ CSTR func = "PGAPI_GetStmtAttr";
StatementClass *stmt = (StatementClass *) StatementHandle;
RETCODE ret = SQL_SUCCESS;
int len = 0;
@@ -1545,7 +1545,7 @@
HSTMT hstmt;
SQLUINTEGER descType;
StatementClass *stmt;
- static const char *func = "PGAPI_GetDescField";
+ CSTR func = "PGAPI_GetDescField";
mylog("%s h=%u rec=%d field=%d blen=%d\n", func, DescriptorHandle, RecNumber, FieldIdentifier, BufferLength);
hstmt = statementHandleFromDescHandle(DescriptorHandle, &descType);
@@ -1600,7 +1600,7 @@
HSTMT hstmt;
SQLUINTEGER descType;
StatementClass *stmt;
- static const char *func = "PGAPI_SetDescField";
+ CSTR func = "PGAPI_SetDescField";
mylog("%s h=%u rec=%d field=%d val=%x,%d\n", func, DescriptorHandle, RecNumber, FieldIdentifier, Value, BufferLength);
hstmt = statementHandleFromDescHandle(DescriptorHandle, &descType);
@@ -1651,7 +1651,7 @@
SQLINTEGER Attribute, PTR Value,
SQLINTEGER StringLength)
{
- static char *func = "PGAPI_SetStmtAttr";
+ CSTR func = "PGAPI_SetStmtAttr";
StatementClass *stmt = (StatementClass *) StatementHandle;
mylog("%s Handle=%u %d,%u\n", func, StatementHandle, Attribute, Value);
@@ -1728,7 +1728,7 @@
RETCODE SQL_API
PGAPI_BulkOperations(HSTMT hstmt, SQLSMALLINT operation)
{
- static char *func = "PGAPI_BulkOperations";
+ CSTR func = "PGAPI_BulkOperations";
StatementClass *stmt = (StatementClass *) hstmt;
ARDFields *opts = SC_get_ARD(stmt);
RETCODE ret;
Index: results.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/results.c,v
retrieving revision 1.61
diff -u -r1.61 results.c
--- results.c 31 Jul 2003 01:57:50 -0000 1.61
+++ results.c 21 Aug 2003 10:30:53 -0000
@@ -38,7 +38,7 @@
HSTMT hstmt,
SDWORD FAR * pcrow)
{
- static char *func = "PGAPI_RowCount";
+ CSTR func = "PGAPI_RowCount";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
ConnInfo *ci;
@@ -98,7 +98,7 @@
HSTMT hstmt,
SWORD FAR * pccol)
{
- static char *func = "PGAPI_NumResultCols";
+ CSTR func = "PGAPI_NumResultCols";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *result;
char parse_ok;
@@ -168,7 +168,7 @@
SWORD FAR * pibScale,
SWORD FAR * pfNullable)
{
- static char *func = "PGAPI_DescribeCol";
+ CSTR func = "PGAPI_DescribeCol";
/* gets all the information about a specific column */
StatementClass *stmt = (StatementClass *) hstmt;
@@ -382,7 +382,7 @@
SWORD FAR * pcbDesc,
SDWORD FAR * pfDesc)
{
- static char *func = "PGAPI_ColAttributes";
+ CSTR func = "PGAPI_ColAttributes";
StatementClass *stmt = (StatementClass *) hstmt;
IRDFields *irdflds;
Int4 col_idx, field_type = 0;
@@ -780,7 +780,7 @@
SDWORD cbValueMax,
SDWORD FAR * pcbValue)
{
- static char *func = "PGAPI_GetData";
+ CSTR func = "PGAPI_GetData";
QResultClass *res;
StatementClass *stmt = (StatementClass *) hstmt;
int num_cols,
@@ -975,7 +975,7 @@
PGAPI_Fetch(
HSTMT hstmt)
{
- static char *func = "PGAPI_Fetch";
+ CSTR func = "PGAPI_Fetch";
StatementClass *stmt = (StatementClass *) hstmt;
ARDFields *opts;
QResultClass *res;
@@ -1130,7 +1130,7 @@
SQLINTEGER bookmark_offset,
SQLINTEGER rowsetSize)
{
- static char *func = "PGAPI_ExtendedFetch";
+ CSTR func = "PGAPI_ExtendedFetch";
StatementClass *stmt = (StatementClass *) hstmt;
ARDFields *opts;
QResultClass *res;
@@ -1556,7 +1556,7 @@
PGAPI_MoreResults(
HSTMT hstmt)
{
- const char *func = "PGAPI_MoreResults";
+ CSTR func = "PGAPI_MoreResults";
StatementClass *stmt = (StatementClass *) hstmt;
QResultClass *res;
@@ -2750,7 +2750,7 @@
UWORD fOption,
UWORD fLock)
{
- static char *func = "PGAPI_SetPos";
+ CSTR func = "PGAPI_SetPos";
RETCODE ret;
StatementClass *stmt = (StatementClass *) hstmt;
ConnectionClass *conn = SC_get_conn(stmt);
@@ -2911,7 +2911,7 @@
SDWORD crowKeyset,
UWORD crowRowset)
{
- static char *func = "PGAPI_SetScrollOptions";
+ CSTR func = "PGAPI_SetScrollOptions";
StatementClass *stmt = (StatementClass *) hstmt;
mylog("PGAPI_SetScrollOptions fConcurrency=%d crowKeyset=%d crowRowset=%d\n",
@@ -2930,7 +2930,7 @@
UCHAR FAR * szCursor,
SWORD cbCursor)
{
- static char *func = "PGAPI_SetCursorName";
+ CSTR func = "PGAPI_SetCursorName";
StatementClass *stmt = (StatementClass *) hstmt;
int len;
@@ -2964,7 +2964,7 @@
SWORD cbCursorMax,
SWORD FAR * pcbCursor)
{
- static char *func = "PGAPI_GetCursorName";
+ CSTR func = "PGAPI_GetCursorName";
StatementClass *stmt = (StatementClass *) hstmt;
int len = 0;
RETCODE result;
Index: statement.c
===================================================================
RCS file: /usr/local/cvsroot/psqlodbc/psqlodbc/statement.c,v
retrieving revision 1.80
diff -u -r1.80 statement.c
--- statement.c 31 Jul 2003 01:57:50 -0000 1.80
+++ statement.c 21 Aug 2003 10:30:53 -0000
@@ -81,7 +81,7 @@
PGAPI_AllocStmt(HDBC hdbc,
HSTMT FAR * phstmt)
{
- static char *func = "PGAPI_AllocStmt";
+ CSTR func = "PGAPI_AllocStmt";
ConnectionClass *conn = (ConnectionClass *) hdbc;
StatementClass *stmt;
@@ -135,7 +135,7 @@
PGAPI_FreeStmt(HSTMT hstmt,
UWORD fOption)
{
- static char *func = "PGAPI_FreeStmt";
+ CSTR func = "PGAPI_FreeStmt";
StatementClass *stmt = (StatementClass *) hstmt;
mylog("%s: entering...hstmt=%u, fOption=%d\n", func, hstmt, fOption);
@@ -845,7 +845,7 @@
RETCODE
SC_fetch(StatementClass *self)
{
- static char *func = "SC_fetch";
+ CSTR func = "SC_fetch";
QResultClass *res = SC_get_Curres(self);
ARDFields *opts;
int retval,
@@ -1024,7 +1024,7 @@
RETCODE
SC_execute(StatementClass *self)
{
- static char *func = "SC_execute";
+ CSTR func = "SC_execute";
ConnectionClass *conn;
APDFields *apdopts;
char was_ok, was_nonfatal, was_rows_affected = 1;
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Optimize the function names variable
2003-08-21 10:36 Optimize the function names variable Shachar Shemesh <psql@shemesh.biz>
@ 2003-08-22 14:02 ` Hiroshi Inoue <inoue@tpf.co.jp>
0 siblings, 0 replies; 2+ messages in thread
From: Hiroshi Inoue @ 2003-08-22 14:02 UTC (permalink / raw)
To: 'Shachar Shemesh' <psql@shemesh.biz>; +Cc: pgsql-odbc
> -----Original Message-----
> From: Shachar Shemesh
>
> Hi all,
>
> The attached patch changes the storage type of the debug
> "func" variables to be
> stored in the constant area of the program, and not store the
> pointers in memory
> by making them static and const.
>
> Not overly important in the grand scheme of things, but useful.
OK I would commit your change to cvs.
Thanks.
Hiroshi Inoue
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-08-22 14:02 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-21 10:36 Optimize the function names variable Shachar Shemesh <psql@shemesh.biz>
2003-08-22 14:02 ` Hiroshi Inoue <inoue@tpf.co.jp>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox