Put structure check fields behind SS_DEBUG macros. Thus, they are only included in debug builds.
This commit is contained in:
parent
27338c2537
commit
e1d7a5640d
@ -91,9 +91,10 @@ HASHTABLE *rval;
|
||||
if ((rval = malloc(sizeof(HASHTABLE))) == NULL)
|
||||
return NULL;
|
||||
|
||||
#if defined(SS_DEBUG)
|
||||
rval->ht_chk_top = CHK_NUM_HASHTABLE;
|
||||
rval->ht_chk_tail = CHK_NUM_HASHTABLE;
|
||||
|
||||
#endif
|
||||
rval->hashsize = size;
|
||||
rval->hashfn = hashfn;
|
||||
rval->cmpfn = cmpfn;
|
||||
|
@ -77,10 +77,10 @@ session_alloc(SERVICE *service, DCB *client)
|
||||
strerror(eno));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#if defined(SS_DEBUG)
|
||||
session->ses_chk_top = CHK_NUM_SESSION;
|
||||
session->ses_chk_tail = CHK_NUM_SESSION;
|
||||
#endif
|
||||
spinlock_init(&session->ses_lock);
|
||||
/**
|
||||
* Prevent backend threads from accessing before session is completely
|
||||
|
@ -68,7 +68,9 @@ typedef void *(*HASHMEMORYFN)(void *);
|
||||
* The general purpose hashtable struct.
|
||||
*/
|
||||
typedef struct hashtable {
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t ht_chk_top;
|
||||
#endif
|
||||
int hashsize; /**< The number of HASHENTRIES */
|
||||
HASHENTRIES **entries; /**< The entries themselves */
|
||||
int (*hashfn)(void *); /**< The hash function */
|
||||
@ -78,7 +80,9 @@ typedef struct hashtable {
|
||||
SPINLOCK spin; /**< Internal spinlock for the hashtable */
|
||||
int n_readers; /**< Number of clients reading the table */
|
||||
int writelock; /**< The table is locked by a writer */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t ht_chk_tail;
|
||||
#endif
|
||||
} HASHTABLE;
|
||||
|
||||
extern HASHTABLE *hashtable_alloc(int, int (*hashfn)(), int (*cmpfn)());
|
||||
|
@ -65,7 +65,9 @@ typedef enum {
|
||||
* and originating service together for the client session.
|
||||
*/
|
||||
typedef struct session {
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t ses_chk_top;
|
||||
#endif
|
||||
SPINLOCK ses_lock;
|
||||
session_state_t state; /**< Current descriptor state */
|
||||
struct dcb *client; /**< The client connection */
|
||||
@ -76,7 +78,9 @@ typedef struct session {
|
||||
struct service *service; /**< The service this session is using */
|
||||
struct session *next; /**< Linked list of all sessions */
|
||||
int refcount; /**< Reference count on the session */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t ses_chk_tail;
|
||||
#endif
|
||||
} SESSION;
|
||||
|
||||
#define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client, type)
|
||||
|
@ -100,7 +100,9 @@ typedef enum {
|
||||
* MySQL Protocol specific state data
|
||||
*/
|
||||
typedef struct {
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t protocol_chk_top;
|
||||
#endif
|
||||
int fd; /* The socket descriptor */
|
||||
struct dcb *owner_dcb; /** The DCB of the socket
|
||||
* we are running on */
|
||||
@ -113,7 +115,9 @@ typedef struct {
|
||||
* created or received */
|
||||
unsigned long tid; /** MySQL Thread ID, in
|
||||
* handshake */
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t protocol_chk_tail;
|
||||
#endif
|
||||
} MySQLProtocol;
|
||||
|
||||
/*
|
||||
|
@ -62,8 +62,10 @@ MySQLProtocol* mysql_protocol_init(
|
||||
goto return_p;
|
||||
}
|
||||
p->state = MYSQL_ALLOC;
|
||||
#if defined(SS_DEBUG)
|
||||
p->protocol_chk_top = CHK_NUM_PROTOCOL;
|
||||
p->protocol_chk_tail = CHK_NUM_PROTOCOL;
|
||||
#endif
|
||||
p->fd = dcb->fd;
|
||||
p->owner_dcb = dcb;
|
||||
dcb->protocol = p;
|
||||
|
Loading…
x
Reference in New Issue
Block a user