Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alfredh_test_remain_e…
Browse files Browse the repository at this point in the history
…nterleave
  • Loading branch information
alfredh committed Sep 7, 2023
2 parents 36bacde + 9f69a23 commit 1de6c8c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 95 deletions.
4 changes: 0 additions & 4 deletions include/re_dbg.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ void dbg_close(void);
int dbg_logfile_set(const char *name);
void dbg_handler_set(dbg_print_h *ph, void *arg);
void dbg_printf(int level, const char *fmt, ...);
void dbg_noprintf(const char *fmt, ...);
void dbg_warning(const char *fmt, ...);
void dbg_notice(const char *fmt, ...);
void dbg_info(const char *fmt, ...);
const char *dbg_level_str(int level);

#ifdef __cplusplus
Expand Down
15 changes: 0 additions & 15 deletions include/re_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,21 +147,6 @@ typedef SSIZE_T ssize_t;
#define ENODATA 200
#endif

/** Protocol error */
#ifndef EPROTO
#define EPROTO 201
#endif

/** Not a data message */
#ifndef EBADMSG
#define EBADMSG 202
#endif

/** Value too large for defined data type */
#ifndef EOVERFLOW
#define EOVERFLOW 203
#endif

/** Accessing a corrupted shared library */
#ifndef ELIBBAD
#define ELIBBAD 204
Expand Down
68 changes: 0 additions & 68 deletions src/dbg/dbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,74 +235,6 @@ void dbg_printf(int level, const char *fmt, ...)
}


/**
* Print a formatted debug message to /dev/null
*
* @param fmt Formatted string
*/
void dbg_noprintf(const char *fmt, ...)
{
(void)fmt;
}


/**
* Print a formatted warning message
*
* @param fmt Formatted string
*/
void dbg_warning(const char *fmt, ...)
{
va_list ap;

va_start(ap, fmt);
dbg_vprintf(DBG_WARNING, fmt, ap);
va_end(ap);

va_start(ap, fmt);
dbg_fmt_vprintf(DBG_WARNING, fmt, ap);
va_end(ap);
}


/**
* Print a formatted notice message
*
* @param fmt Formatted string
*/
void dbg_notice(const char *fmt, ...)
{
va_list ap;

va_start(ap, fmt);
dbg_vprintf(DBG_NOTICE, fmt, ap);
va_end(ap);

va_start(ap, fmt);
dbg_fmt_vprintf(DBG_NOTICE, fmt, ap);
va_end(ap);
}


/**
* Print a formatted info message
*
* @param fmt Formatted string
*/
void dbg_info(const char *fmt, ...)
{
va_list ap;

va_start(ap, fmt);
dbg_vprintf(DBG_INFO, fmt, ap);
va_end(ap);

va_start(ap, fmt);
dbg_fmt_vprintf(DBG_INFO, fmt, ap);
va_end(ap);
}


/**
* Get the name of the debug level
*
Expand Down
17 changes: 9 additions & 8 deletions test/remain.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static void tmr_handler(void *arg)

mtx_unlock(data->mutex);

/* Stop re_main loop */
re_cancel();
}

Expand All @@ -58,11 +59,12 @@ static int thread_handler(void *arg)

tmr_init(&tmr);

/* Add a worker thread for this thread */
err = re_thread_init();
if (err) {
DEBUG_WARNING("re thread init: %m\n", err);
data->err = err;
return 0;
return err;
}

#ifndef WIN32
Expand All @@ -82,22 +84,21 @@ static int thread_handler(void *arg)
data->err = err;
tmr_cancel(&tmr);

/* cleanup */
tmr_debug();

/* Remove the worker thread for this thread */
re_thread_close();

data->thread_exited = true;

return 0;
return err;
}


static int test_remain_thread(void)
{
struct data data;
int i, err;

memset(&data, 0, sizeof(data));
struct data data = { 0 };
int err;

err = mutex_alloc(&data.mutex);
if (err)
Expand All @@ -107,7 +108,7 @@ static int test_remain_thread(void)
TEST_ERR(err);

/* wait for timer to be called */
for (i=0; i<500; i++) {
for (size_t i=0; i<500; i++) {
mtx_lock(data.mutex);

if (data.tmr_called || data.err) {
Expand Down

0 comments on commit 1de6c8c

Please sign in to comment.