diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index b2f75f3cf..914993350 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -244,7 +244,7 @@ static bool logmanager_init_nomutex( fnames_conf_t* fn; filewriter_t* fw; int err; - bool succp = FALSE; + bool succp = false; lm = (logmanager_t *)calloc(1, sizeof(logmanager_t)); lm->lm_chk_top = CHK_NUM_LOGMANAGER; @@ -288,8 +288,8 @@ static bool logmanager_init_nomutex( /** Wait message from filewriter_thr */ skygw_message_wait(fw->fwr_clientmes); - succp = TRUE; - lm->lm_enabled = TRUE; + succp = true; + lm->lm_enabled = true; return_succp: if (err != 0) { @@ -326,14 +326,14 @@ bool skygw_logmanager_init( int argc, char* argv[]) { - bool succp = FALSE; + bool succp = false; ss_dfprintf(stderr, ">> skygw_logmanager_init\n"); acquire_lock(&lmlock); if (lm != NULL) { - succp = TRUE; + succp = true; goto return_succp; } @@ -432,7 +432,7 @@ void skygw_logmanager_done(void) } CHK_LOGMANAGER(lm); /** Mark logmanager unavailable */ - lm->lm_enabled = FALSE; + lm->lm_enabled = false; /** Wait until all users have left or someone shuts down * logmanager between lock release and acquire. @@ -487,7 +487,7 @@ static logfile_t* logmanager_get_logfile( * does write involve formatting of the string and use of valist argument * * @param spread_down - in, use - * if TRUE, log string is spread to all logs having larger id. + * if true, log string is spread to all logs having larger id. * * @param str_len - in, use * length of formatted string @@ -529,9 +529,9 @@ static int logmanager_write_log( * invalid id, since we don't have logfile yet. */ err = logmanager_write_log(LOGFILE_ERROR, - TRUE, - FALSE, - FALSE, + true, + false, + false, strlen(errstr)+1, errstr, valist); @@ -541,7 +541,7 @@ static int logmanager_write_log( STRLOGID(LOGFILE_ERROR)); } err = -1; - ss_dassert(FALSE); + ss_dassert(false); goto return_err; } lf = &lm->lm_logfile[id]; @@ -587,7 +587,7 @@ static int logmanager_write_log( if (spread_down) { /** - * Write to target log. If spread_down == TRUE, then write + * Write to target log. If spread_down == true, then write * also to all logs with greater logfile id. * LOGFILE_ERROR = 1, * LOGFILE_MESSAGE = 2, @@ -704,7 +704,7 @@ static char* blockbuf_get_writepos( bb_list = &lf->lf_blockbuf_list; /** Lock list */ - simple_mutex_lock(&bb_list->mlist_mutex, TRUE); + simple_mutex_lock(&bb_list->mlist_mutex, true); CHK_MLIST(bb_list); if (bb_list->mlist_nodecount > 0) { @@ -714,7 +714,7 @@ static char* blockbuf_get_writepos( node = bb_list->mlist_first; /** Loop over blockbuf list to find write position */ - while (TRUE) { + while (true) { CHK_MLIST_NODE(node); /** Unlock list */ @@ -724,7 +724,7 @@ static char* blockbuf_get_writepos( CHK_BLOCKBUF(bb); /** Lock buffer */ - simple_mutex_lock(&bb->bb_mutex, TRUE); + simple_mutex_lock(&bb->bb_mutex, true); if (bb->bb_isfull || bb->bb_buf_left < str_len) { /** @@ -733,14 +733,14 @@ static char* blockbuf_get_writepos( * flushing all buffers, and (eventually) frees buffer space. */ blockbuf_register(bb); - bb->bb_isfull = TRUE; + bb->bb_isfull = true; blockbuf_unregister(bb); /** Unlock buffer */ simple_mutex_unlock(&bb->bb_mutex); /** Lock list */ - simple_mutex_lock(&bb_list->mlist_mutex, TRUE); + simple_mutex_lock(&bb_list->mlist_mutex, true); /** * If next node exists move forward. Else check if there is @@ -788,7 +788,7 @@ static char* blockbuf_get_writepos( * there is a block buffer with enough space. */ simple_mutex_unlock(&bb_list->mlist_mutex); - simple_mutex_lock(&bb_list->mlist_mutex, TRUE); + simple_mutex_lock(&bb_list->mlist_mutex, true); node = bb_list->mlist_first; continue; @@ -799,7 +799,7 @@ static char* blockbuf_get_writepos( */ break; } - } /** while (TRUE) */ + } /** while (true) */ } else { /** * Create the first block buffer to logfile's blockbuf list. @@ -808,7 +808,7 @@ static char* blockbuf_get_writepos( CHK_BLOCKBUF(bb); /** Lock buffer */ - simple_mutex_lock(&bb->bb_mutex, TRUE); + simple_mutex_lock(&bb->bb_mutex, true); /** * Increase version to odd to mark list update active update. */ @@ -868,7 +868,7 @@ static char* blockbuf_get_writepos( * If flush flag is set, set buffer full. As a consequence, no-one * can write to it before it is flushed to disk. */ - bb->bb_isfull = (flush == TRUE ? TRUE : bb->bb_isfull); + bb->bb_isfull = (flush == true ? true : bb->bb_isfull); /** Unlock buffer */ simple_mutex_unlock(&bb->bb_mutex); @@ -902,14 +902,14 @@ int skygw_log_enable( { bool err = 0; - if (!logmanager_register(TRUE)) { + if (!logmanager_register(true)) { fprintf(stderr, "ERROR: Can't register to logmanager\n"); err = -1; goto return_err; } CHK_LOGMANAGER(lm); - if (logfile_set_enabled(id, TRUE)) { + if (logfile_set_enabled(id, true)) { lm->lm_enabled_logfiles |= id; } @@ -924,14 +924,14 @@ int skygw_log_disable( { bool err = 0; - if (!logmanager_register(TRUE)) { + if (!logmanager_register(true)) { fprintf(stderr, "ERROR: Can't register to logmanager\n"); err = -1; goto return_err; } CHK_LOGMANAGER(lm); - if (logfile_set_enabled(id, FALSE)) { + if (logfile_set_enabled(id, false)) { lm->lm_enabled_logfiles &= ~id; } @@ -948,7 +948,7 @@ static bool logfile_set_enabled( char* logstr; va_list notused; bool oldval; - bool succp = FALSE; + bool succp = false; int err = 0; logfile_t* lf; @@ -960,9 +960,9 @@ static bool logfile_set_enabled( * invalid id, since we don't have logfile yet. */ err = logmanager_write_log(LOGFILE_ERROR, - TRUE, - FALSE, - FALSE, + true, + false, + false, strlen(errstr)+1, errstr, notused); @@ -971,7 +971,7 @@ static bool logfile_set_enabled( "Writing to logfile %s failed.\n", STRLOGID(LOGFILE_ERROR)); } - ss_dassert(FALSE); + ss_dassert(false); goto return_succp; } lf = &lm->lm_logfile[id]; @@ -985,9 +985,9 @@ static bool logfile_set_enabled( oldval = lf->lf_enabled; lf->lf_enabled = val; err = logmanager_write_log(id, - TRUE, - FALSE, - FALSE, + true, + false, + false, strlen(logstr)+1, logstr, notused); @@ -1001,7 +1001,7 @@ static bool logfile_set_enabled( STRLOGID(id)); goto return_succp; } - succp = TRUE; + succp = true; return_succp: return succp; } @@ -1016,7 +1016,7 @@ int skygw_log_write_flush( va_list valist; size_t len; - if (!logmanager_register(TRUE)) { + if (!logmanager_register(true)) { fprintf(stderr, "ERROR: Can't register to logmanager\n"); err = -1; goto return_err; @@ -1044,7 +1044,7 @@ int skygw_log_write_flush( * Write log string to buffer and add to file write list. */ va_start(valist, str); - err = logmanager_write_log(id, TRUE, TRUE, TRUE, len, str, valist); + err = logmanager_write_log(id, true, true, true, len, str, valist); va_end(valist); if (err != 0) { @@ -1069,7 +1069,7 @@ int skygw_log_write( va_list valist; size_t len; - if (!logmanager_register(TRUE)) { + if (!logmanager_register(true)) { fprintf(stderr, "ERROR: Can't register to logmanager\n"); err = -1; goto return_err; @@ -1097,7 +1097,7 @@ int skygw_log_write( * Write log string to buffer and add to file write list. */ va_start(valist, str); - err = logmanager_write_log(id, FALSE, TRUE, TRUE, len, str, valist); + err = logmanager_write_log(id, false, true, true, len, str, valist); va_end(valist); if (err != 0) { @@ -1118,13 +1118,13 @@ int skygw_log_flush( int err = 0; va_list valist; /**< Dummy, must be present but it is not processed */ - if (!logmanager_register(FALSE)) { + if (!logmanager_register(false)) { ss_dfprintf(stderr, "Can't register to logmanager, nothing to flush\n"); goto return_err; } CHK_LOGMANAGER(lm); - err = logmanager_write_log(id, TRUE, FALSE, FALSE, 0, NULL, valist); + err = logmanager_write_log(id, true, false, false, 0, NULL, valist); if (err != 0) { fprintf(stderr, "skygw_log_flush failed.\n"); @@ -1153,19 +1153,19 @@ return_err: static bool logmanager_register( bool writep) { - bool succp = TRUE; + bool succp = true; acquire_lock(&lmlock); if (lm == NULL || !lm->lm_enabled) { /** * Flush succeeds if logmanager is shut or shutting down. - * returning FALSE so that flusher doesn't access logmanager + * returning false so that flusher doesn't access logmanager * and its members which would probabaly lead to NULL pointer * reference. */ if (!writep) { - succp = FALSE; + succp = false; goto return_succp; } @@ -1247,7 +1247,7 @@ static bool fnames_conf_init( { int opt; int i; - bool succp = FALSE; + bool succp = false; const char* argstr = "-h - help\n" "-a ............(\"skygw_trace\")\n" @@ -1325,7 +1325,7 @@ static bool fnames_conf_init( } ss_dfprintf(stderr, "\n"); - succp = TRUE; + succp = true; fn->fn_state = RUN; CHK_FNAMES_CONF(fn); @@ -1392,7 +1392,7 @@ static char* fname_conf_get_suffix( static bool logfiles_init( logmanager_t* lm) { - bool succp = TRUE; + bool succp = true; int i = LOGFILE_FIRST; while(i<=LOGFILE_LAST && succp) { @@ -1413,7 +1413,7 @@ static void logfile_flush( { CHK_LOGFILE(lf); acquire_lock(&lf->lf_spinlock); - lf->lf_flushflag = TRUE; + lf->lf_flushflag = true; release_lock(&lf->lf_spinlock); skygw_message_send(lf->lf_logmes); } @@ -1423,7 +1423,7 @@ static bool logfile_init( logfile_id_t logfile_id, logmanager_t* logmanager) { - bool succp = FALSE; + bool succp = false; size_t namelen; size_t s; fnames_conf_t* fn = &logmanager->lm_fnames_conf; @@ -1439,7 +1439,7 @@ static bool logfile_init( logfile->lf_npending_writes = 0; logfile->lf_name_sequence = 1; logfile->lf_lmgr = logmanager; - logfile->lf_flushflag = FALSE; + logfile->lf_flushflag = false; logfile->lf_spinlock = 0; logfile->lf_enabled = logmanager->lm_enabled_logfiles & logfile_id; /** Read existing files to logfile->lf_files_list and create @@ -1479,7 +1479,7 @@ static bool logfile_init( logfile_free_memory(logfile); goto return_with_succp; } - succp = TRUE; + succp = true; logfile->lf_state = RUN; CHK_LOGFILE(logfile); @@ -1557,7 +1557,7 @@ static bool filewriter_init( skygw_message_t* clientmes, skygw_message_t* logmes) { - bool succp = FALSE; + bool succp = false; logfile_t* lf; logfile_id_t id; int i; @@ -1593,12 +1593,12 @@ static bool filewriter_init( skygw_file_write(fw->fwr_file[id], (void *)start_msg_str, strlen(start_msg_str), - TRUE); + true); free(start_msg_str); } fw->fwr_state = RUN; CHK_FILEWRITER(fw); - succp = TRUE; + succp = true; return_succp: if (!succp) { filewriter_done(fw); @@ -1645,9 +1645,9 @@ static void filewriter_done( * lists of each logfile object. * * Block buffer is written to log file if - * 1. bb_isfull == TRUE, - * 2. logfile object's lf_flushflag == TRUE, or - * 3. skygw_thread_must_exit returns TRUE. + * 1. bb_isfull == true, + * 2. logfile object's lf_flushflag == true, or + * 3. skygw_thread_must_exit returns true. * * Log file is flushed (fsync'd) in cases #2 and #3. * @@ -1722,7 +1722,7 @@ static void* thr_filewriter_fun( */ acquire_lock(&lf->lf_spinlock); flush_logfile = lf->lf_flushflag; - lf->lf_flushflag = FALSE; + lf->lf_flushflag = false; release_lock(&lf->lf_spinlock); /** @@ -1730,7 +1730,7 @@ static void* thr_filewriter_fun( */ bb_list = &lf->lf_blockbuf_list; #if defined(SS_DEBUG) - simple_mutex_lock(&bb_list->mlist_mutex, TRUE); + simple_mutex_lock(&bb_list->mlist_mutex, true); CHK_MLIST(bb_list); simple_mutex_unlock(&bb_list->mlist_mutex); #endif @@ -1742,7 +1742,7 @@ static void* thr_filewriter_fun( CHK_BLOCKBUF(bb); /** Lock block buffer */ - simple_mutex_lock(&bb->bb_mutex, TRUE); + simple_mutex_lock(&bb->bb_mutex, true); flush_blockbuf = bb->bb_isfull; @@ -1754,7 +1754,7 @@ static void* thr_filewriter_fun( */ while(bb->bb_refcount > 0) { simple_mutex_unlock(&bb->bb_mutex); - simple_mutex_lock(&bb->bb_mutex, TRUE); + simple_mutex_lock(&bb->bb_mutex, true); } skygw_file_write(file, @@ -1767,7 +1767,7 @@ static void* thr_filewriter_fun( bb->bb_buf_left = bb->bb_buf_size; bb->bb_buf_used = 0; memset(bb->bb_buf, 0, bb->bb_buf_size); - bb->bb_isfull = FALSE; + bb->bb_isfull = false; } /** Release lock to block buffer */ simple_mutex_unlock(&bb->bb_mutex); @@ -1786,7 +1786,7 @@ static void* thr_filewriter_fun( * Loop is restarted to ensure that all logfiles are flushed. */ if (!flushall_logfiles && skygw_thread_must_exit(thr)) { - flushall_logfiles = TRUE; + flushall_logfiles = true; i = LOGFILE_FIRST; goto retry_flush_on_exit; } diff --git a/utils/skygw_debug.h b/utils/skygw_debug.h index 6bb0df780..2382d5f11 100644 --- a/utils/skygw_debug.h +++ b/utils/skygw_debug.h @@ -110,10 +110,13 @@ typedef enum skygw_chk_t { CHK_NUM_LOGMANAGER, CHK_NUM_FILE, CHK_NUM_BLOCKBUF, - CHK_NUM_HASHTABLE + CHK_NUM_HASHTABLE, + CHK_NUM_DCB, + CHK_NUM_PROTOCOL, + CHK_NUM_SESSION } skygw_chk_t; -# define STRBOOL(b) ((b) ? "TRUE" : "FALSE") +# define STRBOOL(b) ((b) ? "true" : "false") # define STRQTYPE(t) ((t) == QUERY_TYPE_WRITE ? "QUERY_TYPE_WRITE" : \ ((t) == QUERY_TYPE_READ ? "QUERY_TYPE_READ" : \ ((t) == QUERY_TYPE_SESSION_WRITE ? "QUERY_TYPE_SESSION_WRITE" : \ @@ -139,6 +142,22 @@ typedef enum skygw_chk_t { ((p) == COM_DELAYED_INSERT ? "COM_DELAYED_INSERT" : \ ((p) == COM_DAEMON ? "COM_DAEMON" : "UNKNOWN MYSQL PACKET TYPE"))))))))))))))) +#define STRDCBSTATE(s) ((s) == DCB_STATE_ALLOC ? "DCB_STATE_ALLOC" : \ + ((s) == DCB_STATE_IDLE ? "DCB_STATE_IDLE" : \ + ((s) == DCB_STATE_POLLING ? "DCB_STATE_POLLING" : \ + ((s) == DCB_STATE_PROCESSING ? "DCB_STATE_PROCESSING" : \ + ((s) == DCB_STATE_LISTENING ? "DCB_STATE_LISTENING" : \ + ((s) == DCB_STATE_DISCONNECTED ? "DCB_STATE_DISCONNECTED" : \ + ((s) == DCB_STATE_FREED ? "DCB_STATE_FREED" : \ + ((s) == DCB_STATE_ZOMBIE ? "DCB_STATE_ZOMBIE" : "DCB_STATE_UNKNOWN")))))))) + +#define STRSESSIONSTATE(s) ((s) == SESSION_STATE_ALLOC ? "SESSION_STATE_ALLOC" : \ + ((s) == SESSION_STATE_READY ? "SESSION_STATE_READY" : \ + ((s) == SESSION_STATE_LISTENER ? "SESSION_STATE_LISTENER" : \ + ((s) == SESSION_STATE_LISTENER_STOPPED ? "SESSION_STATE_LISTENER_STOPPED" : \ + "SESSION_STATE_UNKNOWN")))) + + #define CHK_MLIST(l) { \ ss_info_dassert((l->mlist_chk_top == CHK_NUM_MLIST && \ l->mlist_chk_tail == CHK_NUM_MLIST), \ @@ -247,11 +266,11 @@ typedef enum skygw_chk_t { "Invalid logfile id\n"); \ (lf->lf_chk_top != CHK_NUM_LOGFILE || \ lf->lf_chk_tail != CHK_NUM_LOGFILE ? \ - FALSE : \ + false : \ (lf->lf_logpath == NULL || \ lf->lf_name_prefix == NULL || \ lf->lf_name_suffix == NULL || \ - lf->lf_full_name == NULL ? FALSE : TRUE)); \ + lf->lf_full_name == NULL ? false : true)); \ } #define CHK_FILEWRITER(fwr) { \ @@ -322,4 +341,22 @@ typedef enum skygw_chk_t { "Hashtable under- or overflow"); \ } +#define CHK_DCB(d) { \ + ss_info_dassert(d->dcb_chk_top == CHK_NUM_DCB && \ + d->dcb_chk_tail == CHK_NUM_DCB, \ + "Dcb under- or overflow"); \ + } + +#define CHK_PROTOCOL(p) { \ + ss_info_dassert(p->protocol_chk_top == CHK_NUM_PROTOCOL && \ + p->protocol_chk_tail == CHK_NUM_PROTOCOL, \ + "Protocol under- or overflow"); \ + } + +#define CHK_SESSION(s) { \ + ss_info_dassert(s->ses_chk_top == CHK_NUM_SESSION && \ + s->ses_chk_tail == CHK_NUM_SESSION, \ + "Session under- or overflow"); \ + } + #endif /* SKYGW_DEBUG_H */ diff --git a/utils/skygw_types.h b/utils/skygw_types.h index 99d36a299..ec1f89686 100644 --- a/utils/skygw_types.h +++ b/utils/skygw_types.h @@ -15,12 +15,12 @@ * * Copyright SkySQL Ab 2013 */ - -#include - #if !defined(SKYGW_TYPES_H) #define SKYGW_TYPES_H +#include +#include + #define SECOND_USEC (1024*1024L) #define MSEC_USEC (1024L) @@ -36,15 +36,4 @@ #define UINTLEN(i) (i<10 ? 1 : (i<100 ? 2 : (i<1000 ? 3 : CALCLEN(i)))) -#if defined(__cplusplus) && !defined(TRUE) && !defined(FALSE) -# define TRUE true -# define FALSE false -#elif !defined(TRUE) && !defined(FALSE) -typedef enum {FALSE=0, TRUE} bool; -#else -# if !defined(bool) -# define bool int -# endif -#endif - #endif /* SKYGW_TYPES_H */ diff --git a/utils/skygw_utils.cc b/utils/skygw_utils.cc index 809600fac..94d2565ea 100644 --- a/utils/skygw_utils.cc +++ b/utils/skygw_utils.cc @@ -294,7 +294,7 @@ mlist_t* mlist_init( } else { /** Caller wants list flat, memory won't be freed */ list = listp; - list->mlist_flat = TRUE; + list->mlist_flat = true; } ss_dassert(list != NULL); @@ -412,7 +412,7 @@ mlist_cursor_t* mlist_cursor_init( mlist_cursor_t* c; /** acquire shared lock to the list */ - simple_mutex_lock(&list->mlist_mutex, TRUE); + simple_mutex_lock(&list->mlist_mutex, true); c = (mlist_cursor_t *)calloc(1, sizeof(mlist_cursor_t)); @@ -453,8 +453,8 @@ void mlist_done( mlist_t* list) { CHK_MLIST(list); - simple_mutex_lock(&list->mlist_mutex, TRUE); - list->mlist_deleted = TRUE; + simple_mutex_lock(&list->mlist_mutex, true); + list->mlist_deleted = true; simple_mutex_unlock(&list->mlist_mutex); simple_mutex_done(&list->mlist_mutex); mlist_free_memory(list, list->mlist_name); @@ -478,7 +478,7 @@ void* mlist_cursor_get_data_nomutex( * @param data - * * - * @return TRUE, if succeed, FALSE, if list had node limit and it is full. + * @return true, if succeed, false, if list had node limit and it is full. * * * @details (write detailed description here) @@ -550,7 +550,7 @@ mlist_node_t* mlist_detach_first( * @param add_last - * * - * @return TRUE, if succeede, FALSE, if list size limit was exceeded. + * @return true, if succeede, false, if list size limit was exceeded. * * * @details (write detailed description here) @@ -560,7 +560,7 @@ bool mlist_add_node_nomutex( mlist_t* list, mlist_node_t* newnode) { - bool succp = FALSE; + bool succp = false; CHK_MLIST(list); CHK_MLIST_NODE(newnode); @@ -583,7 +583,7 @@ bool mlist_add_node_nomutex( list->mlist_last = newnode; newnode->mlnode_list = list; list->mlist_nodecount += 1; - succp = TRUE; + succp = true; return_succp: CHK_MLIST(list); return succp; @@ -594,23 +594,23 @@ return_succp: bool mlist_cursor_move_to_first( mlist_cursor_t* mc) { - bool succp = FALSE; + bool succp = false; mlist_t* list; CHK_MLIST_CURSOR(mc); list = mc->mlcursor_list; CHK_MLIST(list); - simple_mutex_lock(&list->mlist_mutex, TRUE); + simple_mutex_lock(&list->mlist_mutex, true); if (mc->mlcursor_list->mlist_deleted) { - return FALSE; + return false; } /** Set position point to first node */ mc->mlcursor_pos = list->mlist_first; if (mc->mlcursor_pos != NULL) { CHK_MLIST_NODE(mc->mlcursor_pos); - succp = TRUE; + succp = true; } simple_mutex_unlock(&list->mlist_mutex); return succp; @@ -683,7 +683,7 @@ static slist_t* slist_init_ex( list->slist_chk_tail = CHK_NUM_SLIST; if (create_cursors) { - list->slist_cursors_list = slist_init_ex(FALSE); + list->slist_cursors_list = slist_init_ex(false); } return list; @@ -814,7 +814,7 @@ slist_cursor_t* slist_init(void) slist_t* list; slist_cursor_t* slc; - list = slist_init_ex(TRUE); + list = slist_init_ex(true); CHK_SLIST(list); slc = slist_cursor_init(list); CHK_SLIST_CURSOR(slc); @@ -832,8 +832,8 @@ slist_cursor_t* slist_init(void) * @param c - * * - * @return TRUE if there is first node in the list - * FALSE is the list is empty. + * @return true if there is first node in the list + * false is the list is empty. * * * @details (write detailed description here) @@ -842,7 +842,7 @@ slist_cursor_t* slist_init(void) bool slcursor_move_to_begin( slist_cursor_t* c) { - bool succp = TRUE; + bool succp = true; slist_t* list; CHK_SLIST_CURSOR(c); @@ -850,7 +850,7 @@ bool slcursor_move_to_begin( CHK_SLIST(list); c->slcursor_pos = list->slist_head; if (c->slcursor_pos == NULL) { - succp = FALSE; + succp = false; } return succp; } @@ -862,7 +862,7 @@ bool slcursor_move_to_begin( * @param c - * * - * @return TRUE in success, FALSE is there is no next node on the list. + * @return true in success, false is there is no next node on the list. * * * @details (write detailed description here) @@ -871,7 +871,7 @@ bool slcursor_move_to_begin( bool slcursor_step_ahead( slist_cursor_t* c) { - bool succp = FALSE; + bool succp = false; slist_node_t* node; CHK_SLIST_CURSOR(c); CHK_SLIST_NODE(c->slcursor_pos); @@ -881,7 +881,7 @@ bool slcursor_step_ahead( if (node != NULL) { CHK_SLIST_NODE(node); c->slcursor_pos = node; - succp = TRUE; + succp = true; } return succp; } @@ -1113,7 +1113,7 @@ void skygw_thread_set_state( skygw_thr_state_t state) { CHK_THREAD(thr); - simple_mutex_lock(thr->sth_mutex, TRUE); + simple_mutex_lock(thr->sth_mutex, true); thr->sth_state = state; simple_mutex_unlock(thr->sth_mutex); } @@ -1136,23 +1136,23 @@ bool skygw_thread_set_exitflag( skygw_message_t* sendmes, skygw_message_t* recmes) { - bool succp = FALSE; + bool succp = false; /** * If thread struct pointer is NULL there's running thread * neither. */ if (thr == NULL) { - succp = TRUE; + succp = true; goto return_succp; } CHK_THREAD(thr); CHK_MESSAGE(sendmes); CHK_MESSAGE(recmes); - simple_mutex_lock(thr->sth_mutex, TRUE); + simple_mutex_lock(thr->sth_mutex, true); succp = !thr->sth_must_exit; - thr->sth_must_exit = TRUE; + thr->sth_must_exit = true; simple_mutex_unlock(thr->sth_mutex); /** Inform thread and wait for response */ @@ -1213,7 +1213,7 @@ void release_lock( * * * @details If mutex is flat, sm_enabled can be read if the memory is not freed. - * If flat mutex exists, sm_enabled is TRUE. + * If flat mutex exists, sm_enabled is true. * If mutex allocates its own memory, the pointer is NULL if mutex doesn't * exist. * @@ -1228,7 +1228,7 @@ simple_mutex_t* simple_mutex_init( /** Copy pointer only if flat, allocate memory otherwise. */ if (mutexptr != NULL) { sm = mutexptr; - sm->sm_flat = TRUE; + sm->sm_flat = true; } else { sm = (simple_mutex_t *)calloc(1, sizeof(simple_mutex_t)); } @@ -1258,7 +1258,7 @@ simple_mutex_t* simple_mutex_init( } goto return_sm; } - sm->sm_enabled = TRUE; + sm->sm_enabled = true; CHK_SIMPLE_MUTEX(sm); ss_dfprintf(stderr, "Initialized simple mutex %s.\n", name); @@ -1330,7 +1330,7 @@ int simple_mutex_lock( strerror(errno)); perror("simple_mutex : "); } else { - sm->sm_locked = TRUE; + sm->sm_locked = true; sm->sm_lock_thr = pthread_self(); } return err; @@ -1352,7 +1352,7 @@ int simple_mutex_unlock( strerror(errno)); perror("simple_mutex : "); } else { - sm->sm_locked = FALSE; + sm->sm_locked = false; sm->sm_lock_thr = 0; } return err; @@ -1445,7 +1445,7 @@ skygw_mes_rc_t skygw_message_send( strerror(errno)); goto return_mes_rc; } - mes->mes_sent = TRUE; + mes->mes_sent = true; err = pthread_cond_signal(&(mes->mes_cond)); if (err != 0) { @@ -1500,7 +1500,7 @@ void skygw_message_wait( strerror(errno)); } } - mes->mes_sent = FALSE; + mes->mes_sent = false; err = pthread_mutex_unlock(&(mes->mes_mutex)); if (err != 0) { @@ -1531,7 +1531,7 @@ void skygw_message_reset( goto return_mes_rc; } ss_dassert(err == 0); - mes->mes_sent = FALSE; + mes->mes_sent = false; err = pthread_mutex_unlock(&(mes->mes_mutex)); if (err != 0) { @@ -1549,7 +1549,7 @@ return_mes_rc: static bool file_write_header( skygw_file_t* file) { - bool succp = FALSE; + bool succp = false; size_t wbytes1; size_t wbytes2; size_t wbytes3; @@ -1610,7 +1610,7 @@ static bool file_write_header( #endif CHK_FILE(file); - succp = TRUE; + succp = true; return_succp: if (header_buf2 != NULL) { free(header_buf2); @@ -1626,7 +1626,7 @@ return_succp: static bool file_write_footer( skygw_file_t* file) { - bool succp = FALSE; + bool succp = false; size_t wbytes1; size_t wbytes3; size_t wbytes4; @@ -1669,7 +1669,7 @@ static bool file_write_footer( #endif CHK_FILE(file); - succp = TRUE; + succp = true; return_succp: if (header_buf3 != NULL) { free(header_buf3); @@ -1684,7 +1684,7 @@ bool skygw_file_write( size_t nbytes, bool flush) { - bool succp = FALSE; + bool succp = false; int err = 0; #if !defined(LAPTOP_TEST) size_t nwritten; @@ -1716,7 +1716,7 @@ bool skygw_file_write( writecount = 0; } #endif - succp = TRUE; + succp = true; CHK_FILE(file); return_succp: return succp;