From 916a95ad697c5aa9f774eebeb0f030963749c65f Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Wed, 8 Jan 2025 15:18:04 +0000 Subject: [PATCH] ctlib: Remove initial underscore from field names Other fields do not start with underscore. Just style change. Signed-off-by: Frediano Ziglio --- include/ctlib.h | 14 +++++++------- src/ctlib/cs.c | 12 ++++++------ src/ctlib/ct.c | 26 +++++++++++++------------- src/ctlib/ctutil.c | 32 ++++++++++++++++---------------- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/include/ctlib.h b/include/ctlib.h index 58b788efe..2a3a40e8b 100644 --- a/include/ctlib.h +++ b/include/ctlib.h @@ -149,10 +149,10 @@ struct _cs_context /* code changes ends here - CT_DIAG - 02 */ struct cs_diag_msg *msgstore; - CS_CSLIBMSG_FUNC _cslibmsg_cb; - CS_CLIENTMSG_FUNC _clientmsg_cb; - CS_SERVERMSG_FUNC _servermsg_cb; - CS_INTERRUPT_FUNC _interrupt_cb; + CS_CSLIBMSG_FUNC cslibmsg_cb; + CS_CLIENTMSG_FUNC clientmsg_cb; + CS_SERVERMSG_FUNC servermsg_cb; + CS_INTERRUPT_FUNC interrupt_cb; /* code changes start here - CS_CONFIG - 01*/ void *userdata; int userdata_len; @@ -189,9 +189,9 @@ struct _cs_connection CS_CONTEXT *ctx; TDSLOGIN *tds_login; TDSSOCKET *tds_socket; - CS_CLIENTMSG_FUNC _clientmsg_cb; - CS_SERVERMSG_FUNC _servermsg_cb; - CS_INTERRUPT_FUNC _interrupt_cb; + CS_CLIENTMSG_FUNC clientmsg_cb; + CS_SERVERMSG_FUNC servermsg_cb; + CS_INTERRUPT_FUNC interrupt_cb; void *userdata; int userdata_len; CS_LOCALE *locale; diff --git a/src/ctlib/cs.c b/src/ctlib/cs.c index d8bfc64c3..724004a8b 100644 --- a/src/ctlib/cs.c +++ b/src/ctlib/cs.c @@ -187,7 +187,7 @@ _csclient_msg(CS_CONTEXT * ctx, const char *funcname, int layer, int origin, int va_start(ap, fmt); - if (ctx->_cslibmsg_cb) { + if (ctx->cslibmsg_cb) { cm.severity = severity; cm.msgnumber = (((layer << 24) & 0xFF000000) | ((origin << 16) & 0x00FF0000) @@ -203,7 +203,7 @@ _csclient_msg(CS_CONTEXT * ctx, const char *funcname, int layer, int origin, int cm.status = 0; /* cm.sqlstate */ cm.sqlstatelen = 0; - ctx->_cslibmsg_cb(ctx, &cm); + ctx->cslibmsg_cb(ctx, &cm); } va_end(ap); @@ -406,7 +406,7 @@ cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS } switch (property) { case CS_MESSAGE_CB: - *(CS_CSLIBMSG_FUNC*) buffer = ctx->_cslibmsg_cb; + *(CS_CSLIBMSG_FUNC*) buffer = ctx->cslibmsg_cb; return CS_SUCCEED; case CS_USERDATA: if (buflen < 0) { @@ -440,7 +440,7 @@ cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS if ( ctx->cs_errhandletype == _CS_ERRHAND_INLINE) { cs_diag_clearmsg(ctx, CS_UNUSED); } - ctx->_cslibmsg_cb = (CS_CSLIBMSG_FUNC) buffer; + ctx->cslibmsg_cb = (CS_CSLIBMSG_FUNC) buffer; ctx->cs_errhandletype = _CS_ERRHAND_CB; return CS_SUCCEED; case CS_USERDATA: @@ -479,7 +479,7 @@ cs_config(CS_CONTEXT * ctx, CS_INT action, CS_INT property, CS_VOID * buffer, CS if ( ctx->cs_errhandletype == _CS_ERRHAND_INLINE) { cs_diag_clearmsg(ctx, CS_UNUSED); } - ctx->_cslibmsg_cb = NULL; + ctx->cslibmsg_cb = NULL; ctx->cs_errhandletype = 0; return CS_SUCCEED; case CS_USERDATA: @@ -1277,7 +1277,7 @@ cs_diag(CS_CONTEXT * ctx, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID * b } ctx->cs_errhandletype = _CS_ERRHAND_INLINE; ctx->cs_diag_msglimit = CS_NO_LIMIT; - ctx->_cslibmsg_cb = (CS_CSLIBMSG_FUNC) cs_diag_storemsg; + ctx->cslibmsg_cb = (CS_CSLIBMSG_FUNC) cs_diag_storemsg; break; case CS_MSGLIMIT: if ( ctx->cs_errhandletype != _CS_ERRHAND_INLINE) { diff --git a/src/ctlib/ct.c b/src/ctlib/ct.c index d9889da9d..c0731c618 100644 --- a/src/ctlib/ct.c +++ b/src/ctlib/ct.c @@ -217,10 +217,10 @@ _ctclient_msg(CS_CONTEXT *ctx, CS_CONNECTION * con, const char *funcname, if (con) { ctx = con->ctx; - clientmsg_cb = con->_clientmsg_cb; + clientmsg_cb = con->clientmsg_cb; } if (!clientmsg_cb) - clientmsg_cb = ctx->_clientmsg_cb; + clientmsg_cb = ctx->clientmsg_cb; va_start(ap, fmt); @@ -357,13 +357,13 @@ ct_callback(CS_CONTEXT * ctx, CS_CONNECTION * con, CS_INT action, CS_INT type, C switch (type) { case CS_CLIENTMSG_CB: - out_func = (CS_VOID *) (con ? con->_clientmsg_cb : ctx->_clientmsg_cb); + out_func = (CS_VOID *) (con ? con->clientmsg_cb : ctx->clientmsg_cb); break; case CS_SERVERMSG_CB: - out_func = (CS_VOID *) (con ? con->_servermsg_cb : ctx->_servermsg_cb); + out_func = (CS_VOID *) (con ? con->servermsg_cb : ctx->servermsg_cb); break; case CS_INTERRUPT_CB: - out_func = (CS_VOID *) (con ? con->_interrupt_cb : ctx->_interrupt_cb); + out_func = (CS_VOID *) (con ? con->interrupt_cb : ctx->interrupt_cb); break; default: _ctclient_msg(ctx, con, "ct_callback()", 1, 1, 1, 5, "%d, %s", type, "type"); @@ -382,15 +382,15 @@ ct_callback(CS_CONTEXT * ctx, CS_CONNECTION * con, CS_INT action, CS_INT type, C switch (type) { case CS_CLIENTMSG_CB: if (con) - con->_clientmsg_cb = (CS_CLIENTMSG_FUNC) funcptr; + con->clientmsg_cb = (CS_CLIENTMSG_FUNC) funcptr; else - ctx->_clientmsg_cb = (CS_CLIENTMSG_FUNC) funcptr; + ctx->clientmsg_cb = (CS_CLIENTMSG_FUNC) funcptr; break; case CS_SERVERMSG_CB: if (con) - con->_servermsg_cb = (CS_SERVERMSG_FUNC) funcptr; + con->servermsg_cb = (CS_SERVERMSG_FUNC) funcptr; else - ctx->_servermsg_cb = (CS_SERVERMSG_FUNC) funcptr; + ctx->servermsg_cb = (CS_SERVERMSG_FUNC) funcptr; break; case CS_INTERRUPT_CB: if (funcptr) { @@ -400,9 +400,9 @@ ct_callback(CS_CONTEXT * ctx, CS_CONNECTION * con, CS_INT action, CS_INT type, C ctx->tds_ctx->int_handler = _ct_handle_interrupt; } if (con) - con->_interrupt_cb = (CS_INTERRUPT_FUNC) funcptr; + con->interrupt_cb = (CS_INTERRUPT_FUNC) funcptr; else - ctx->_interrupt_cb = (CS_INTERRUPT_FUNC) funcptr; + ctx->interrupt_cb = (CS_INTERRUPT_FUNC) funcptr; break; default: _ctclient_msg(ctx, con, "ct_callback()", 1, 1, 1, 5, "%d, %s", type, "type"); @@ -4540,8 +4540,8 @@ ct_diag(CS_CONNECTION * conn, CS_INT operation, CS_INT type, CS_INT idx, CS_VOID if (conn->ctx->cs_diag_msglimit_total == 0) conn->ctx->cs_diag_msglimit_total = CS_NO_LIMIT; - conn->ctx->_clientmsg_cb = (CS_CLIENTMSG_FUNC) ct_diag_storeclientmsg; - conn->ctx->_servermsg_cb = (CS_SERVERMSG_FUNC) ct_diag_storeservermsg; + conn->ctx->clientmsg_cb = (CS_CLIENTMSG_FUNC) ct_diag_storeclientmsg; + conn->ctx->servermsg_cb = (CS_SERVERMSG_FUNC) ct_diag_storeservermsg; break; diff --git a/src/ctlib/ctutil.c b/src/ctlib/ctutil.c index 5964eec0d..286acf014 100644 --- a/src/ctlib/ctutil.c +++ b/src/ctlib/ctutil.c @@ -134,12 +134,12 @@ _ct_handle_client_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAG /* if there is no connection, attempt to call the context handler */ if (!con) { ctx = (CS_CONTEXT *) ctx_tds->parent; - if (ctx->_clientmsg_cb) - ret = ctx->_clientmsg_cb(ctx, con, &errmsg); - } else if (con->_clientmsg_cb) - ret = con->_clientmsg_cb(con->ctx, con, &errmsg); - else if (con->ctx->_clientmsg_cb) - ret = con->ctx->_clientmsg_cb(con->ctx, con, &errmsg); + if (ctx->clientmsg_cb) + ret = ctx->clientmsg_cb(ctx, con, &errmsg); + } else if (con->clientmsg_cb) + ret = con->clientmsg_cb(con->ctx, con, &errmsg); + else if (con->ctx->clientmsg_cb) + ret = con->ctx->clientmsg_cb(con->ctx, con, &errmsg); /* * The return code from the error handler is either CS_SUCCEED or CS_FAIL. @@ -171,10 +171,10 @@ int _ct_handle_interrupt(void * ptr) { CS_CONNECTION *con = (CS_CONNECTION *) ptr; - if (con->_interrupt_cb) - return (*con->_interrupt_cb)(con); - else if (con->ctx->_interrupt_cb) - return (*con->ctx->_interrupt_cb)(con); + if (con->interrupt_cb) + return (*con->interrupt_cb)(con); + else if (con->ctx->interrupt_cb) + return (*con->ctx->interrupt_cb)(con); else return TDS_INT_CONTINUE; } @@ -229,12 +229,12 @@ _ct_handle_server_message(const TDSCONTEXT * ctx_tds, TDSSOCKET * tds, TDSMESSAG /* if there is no connection, attempt to call the context handler */ if (!con) { - if (ctx->_servermsg_cb) - ret = ctx->_servermsg_cb(ctx, con, &errmsg.user); - } else if (con->_servermsg_cb) { - ret = con->_servermsg_cb(ctx, con, &errmsg.user); - } else if (ctx->_servermsg_cb) { - ret = ctx->_servermsg_cb(ctx, con, &errmsg.user); + if (ctx->servermsg_cb) + ret = ctx->servermsg_cb(ctx, con, &errmsg.user); + } else if (con->servermsg_cb) { + ret = con->servermsg_cb(ctx, con, &errmsg.user); + } else if (ctx->servermsg_cb) { + ret = ctx->servermsg_cb(ctx, con, &errmsg.user); } return ret == CS_SUCCEED ? TDS_SUCCESS : TDS_FAIL; }