Skip to content
Snippets Groups Projects
Commit d54d125c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

protected integer init() an destroy() just return void now

Nobody's checking the return values anyway.
parent a9967b46
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #1387 failed
......@@ -5046,7 +5046,7 @@ static void cleanup(int code, int line)
if(protected_uint32_value(active_clients))
lprintf(LOG_WARNING,"!!!! Terminating with %d active clients", protected_uint32_value(active_clients));
else
(void)protected_uint32_destroy(active_clients);
protected_uint32_destroy(active_clients);
#ifdef _WINSOCKAPI_
if(WSAInitialized && WSACleanup()!=0)
......@@ -5383,5 +5383,5 @@ void DLLCALL ftp_server(void* arg)
} while(!terminate_server);
(void)protected_uint32_destroy(thread_count);
protected_uint32_destroy(thread_count);
}
......@@ -5927,7 +5927,7 @@ static void cleanup(int code)
if(protected_uint32_value(active_clients))
lprintf(LOG_WARNING,"!!!! Terminating with %d active clients", protected_uint32_value(active_clients));
else
(void)protected_uint32_destroy(active_clients);
protected_uint32_destroy(active_clients);
#ifdef _WINSOCKAPI_
if(WSAInitialized && WSACleanup()!=0)
......@@ -6415,5 +6415,5 @@ void DLLCALL mail_server(void* arg)
} while(!terminate_server);
(void)protected_uint32_destroy(thread_count);
protected_uint32_destroy(thread_count);
}
......@@ -737,8 +737,8 @@ void status_thread(void *arg)
listRemoveNode(&status_sock, node, FALSE);
}
listUnlock(&status_sock);
(void)protected_uint32_destroy(thread_count);
(void)protected_uint32_destroy(active_clients);
protected_uint32_destroy(thread_count);
protected_uint32_destroy(active_clients);
startup->thread_up(startup->cbdata, FALSE, FALSE);
startup->terminated(startup->cbdata, rc);
......
......@@ -445,7 +445,7 @@ js_login(JSContext *cx, uintN argc, jsval *arglist)
val = BOOLEAN_TO_JSVAL(JS_TRUE);
if(!JS_SetProperty(cx, obj, "logged_in", &val))
llprintf(LOG_ERR, "%04d %s Error setting logged in property for %s"
lprintf(LOG_ERR, "%04d %s Error setting logged in property for %s"
,client->socket, client->service->protocol, client->user.alias);
if(client->user.pass[0])
......
......@@ -6749,7 +6749,7 @@ static void cleanup(int code)
if(protected_uint32_value(active_clients))
lprintf(LOG_WARNING,"!!!! Terminating with %u active clients", protected_uint32_value(active_clients));
else
(void)protected_uint32_destroy(active_clients);
protected_uint32_destroy(active_clients);
#ifdef _WINSOCKAPI_
if(WSAInitialized && WSACleanup()!=0)
......@@ -7286,5 +7286,5 @@ void DLLCALL web_server(void* arg)
} while(!terminate_server);
(void)protected_uint32_destroy(thread_count);
protected_uint32_destroy(thread_count);
}
......@@ -218,16 +218,16 @@ int DLLCALL pthread_mutex_destroy(pthread_mutex_t* mutex)
/************************************************************************/
#ifndef __unix__
int DLLCALL protected_int32_init(protected_int32_t* prot, int32_t value)
void DLLCALL protected_int32_init(protected_int32_t* prot, int32_t value)
{
prot->value = value;
return pthread_mutex_init(&prot->mutex,NULL);
pthread_mutex_init(&prot->mutex,NULL);
}
int DLLCALL protected_int64_init(protected_int64_t* prot, int64_t value)
void DLLCALL protected_int64_init(protected_int64_t* prot, int64_t value)
{
prot->value = value;
return pthread_mutex_init(&prot->mutex,NULL);
pthread_mutex_init(&prot->mutex,NULL);
}
int32_t DLLCALL protected_int32_adjust(protected_int32_t* i, int32_t adjustment)
......
......@@ -163,10 +163,10 @@ typedef std::atomic<int32_t> protected_int32_t;
typedef std::atomic<uint32_t> protected_uint32_t;
typedef std::atomic<int64_t> protected_int64_t;
typedef std::atomic<uint64_t> protected_uint64_t;
#define protected_int32_init(pval, val) (std::atomic_store<int32_t>(pval, val), 0)
#define protected_uint32_init(pval, val) (std::atomic_store<uint32_t>(pval, val), 0)
#define protected_int64_init(pval, val) (std::atomic_store<int64_t>(pval, val), 0)
#define protected_uint64_init(pval, val) (std::atomic_store<uint64_t>(pval, val), 0)
#define protected_int32_init(pval, val) std::atomic_store<int32_t>(pval, val)
#define protected_uint32_init(pval, val) std::atomic_store<uint32_t>(pval, val)
#define protected_int64_init(pval, val) std::atomic_store<int64_t>(pval, val)
#define protected_uint64_init(pval, val) std::atomic_store<uint64_t>(pval, val)
#define protected_int32_adjust(pval, adj) std::atomic_fetch_add<int32_t>(pval, adj)
#define protected_uint32_adjust(pval, adj) std::atomic_fetch_add<uint32_t>(pval, adj)
......@@ -188,10 +188,10 @@ typedef _Atomic(uint32_t) protected_uint32_t;
typedef _Atomic(int64_t) protected_int64_t;
typedef _Atomic(uint64_t) protected_uint64_t;
#define protected_int32_init(pval, val) (atomic_init(pval, val), 0)
#define protected_uint32_init(pval, val) (atomic_init(pval, val), 0)
#define protected_int64_init(pval, val) (atomic_init(pval, val), 0)
#define protected_uint64_init(pval, val) (atomic_init(pval, val), 0)
#define protected_int32_init(pval, val) atomic_init(pval, val)
#define protected_uint32_init(pval, val) atomic_init(pval, val)
#define protected_int64_init(pval, val) atomic_init(pval, val)
#define protected_uint64_init(pval, val) atomic_init(pval, val)
#define protected_int32_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_uint32_adjust(pval, adj) atomic_fetch_add(pval, adj)
......@@ -209,10 +209,10 @@ typedef _Atomic(uint64_t) protected_uint64_t;
#define protected_uint64_value(val) atomic_load(&val)
#endif
#define protected_int32_destroy(i) 0
#define protected_uint32_destroy(i) 0
#define protected_int64_destroy(i) 0
#define protected_uint64_destroy(i) 0
#define protected_int32_destroy(i)
#define protected_uint32_destroy(i)
#define protected_int64_destroy(i)
#define protected_uint64_destroy(i)
#else
typedef struct {
int32_t value;
......@@ -252,8 +252,8 @@ typedef struct {
#define protected_uint64_adjust_fetch(a, b) protected_uint64_adjust(a, b)
/* Return 0 on success, non-zero on failure (see pthread_mutex_init): */
DLLEXPORT int DLLCALL protected_int32_init(protected_int32_t*, int32_t value);
DLLEXPORT int DLLCALL protected_int64_init(protected_int64_t*, int64_t value);
DLLEXPORT void DLLCALL protected_int32_init(protected_int32_t*, int32_t value);
DLLEXPORT void DLLCALL protected_int64_init(protected_int64_t*, int64_t value);
/* Return new value: */
DLLEXPORT int32_t DLLCALL protected_int32_adjust(protected_int32_t*, int32_t adjustment);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment