Skip to content

Commit

Permalink
ctlib: Remove initial underscore from field names
Browse files Browse the repository at this point in the history
Other fields do not start with underscore.
Just style change.

Signed-off-by: Frediano Ziglio <[email protected]>
  • Loading branch information
freddy77 committed Jan 8, 2025
1 parent bd8c1ca commit 916a95a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 42 deletions.
14 changes: 7 additions & 7 deletions include/ctlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions src/ctlib/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand Down
26 changes: 13 additions & 13 deletions src/ctlib/ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
Expand All @@ -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) {
Expand All @@ -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");
Expand Down Expand Up @@ -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;

Expand Down
32 changes: 16 additions & 16 deletions src/ctlib/ctutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 916a95a

Please sign in to comment.