From 6e88fdffbcae7d4d149afd486f4d93600bc0c364 Mon Sep 17 00:00:00 2001 From: Guilherme Maciel Ferreira Date: Sun, 17 Apr 2016 20:01:25 -0300 Subject: [PATCH] Ensure an empty parameter list using void According to ISO/IEC 9899:2011, section 6.7.6.3 (Function declarators including prototypes): "The special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters." Signed-off-by: Guilherme Maciel Ferreira --- src/Heap.c | 6 +++--- src/Log.c | 4 ++-- src/Log.h | 2 +- src/MQTTAsync.c | 14 +++++++------- src/MQTTAsync.h | 2 +- src/MQTTClient.c | 10 +++++----- src/SSLSocket.c | 6 +++--- src/SSLSocket.h | 6 +++--- src/Socket.c | 4 ++-- src/Thread.c | 8 ++++---- src/Thread.h | 8 ++++---- test/sync_client_test.c | 26 +++++++++++++------------- test/test1.c | 4 ++-- test/test2.c | 4 ++-- test/test3.c | 4 ++-- test/test4.c | 4 ++-- test/test5.c | 4 ++-- test/test6.c | 6 +++--- test/test8.c | 2 +- test/test9.c | 4 ++-- test/test_mqtt4async.c | 4 ++-- test/test_mqtt4sync.c | 4 ++-- 22 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/Heap.c b/src/Heap.c index 3e946161..49e3fb7a 100755 --- a/src/Heap.c +++ b/src/Heap.c @@ -353,7 +353,7 @@ void HeapScan(int log_level) /** * Heap initialization. */ -int Heap_initialize() +int Heap_initialize(void) { TreeInitializeNoMalloc(&heap, ptrCompare); heap.heap_tracking = 0; /* no recursive heap tracking! */ @@ -364,7 +364,7 @@ int Heap_initialize() /** * Heap termination. */ -void Heap_terminate() +void Heap_terminate(void) { Log(TRACE_MIN, -1, "Maximum heap use was %d bytes", state.max_size); if (state.current_size > 20) /* One log list is freed after this function is called */ @@ -379,7 +379,7 @@ void Heap_terminate() * Access to heap state * @return pointer to the heap state structure */ -heap_info* Heap_get_info() +heap_info* Heap_get_info(void) { return &state; } diff --git a/src/Log.c b/src/Log.c index 3058e68c..047bba05 100644 --- a/src/Log.c +++ b/src/Log.c @@ -210,7 +210,7 @@ void Log_setTraceLevel(enum LOG_LEVELS level) } -void Log_terminate() +void Log_terminate(void) { free(trace_queue); trace_queue = NULL; @@ -232,7 +232,7 @@ void Log_terminate() } -static traceEntry* Log_pretrace() +static traceEntry* Log_pretrace(void) { traceEntry *cur_entry = NULL; diff --git a/src/Log.h b/src/Log.h index 48660c3c..19687592 100644 --- a/src/Log.h +++ b/src/Log.h @@ -72,7 +72,7 @@ typedef struct } Log_nameValue; int Log_initialize(Log_nameValue*); -void Log_terminate(); +void Log_terminate(void); void Log(int, int, char *, ...); void Log_stackTrace(int, int, int, int, const char*, int, int*); diff --git a/src/MQTTAsync.c b/src/MQTTAsync.c index c245eeeb..3e19aebd 100755 --- a/src/MQTTAsync.c +++ b/src/MQTTAsync.c @@ -143,7 +143,7 @@ static mutex_type mqttcommand_mutex = &mqttcommand_mutex_store; static cond_type_struct send_cond_store = { PTHREAD_COND_INITIALIZER, PTHREAD_MUTEX_INITIALIZER }; static cond_type send_cond = &send_cond_store; -void MQTTAsync_init() +void MQTTAsync_init(void) { pthread_mutexattr_t attr; int rc; @@ -173,7 +173,7 @@ static List* commands = NULL; MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc); int MQTTAsync_cleanSession(Clients* client); -void MQTTAsync_stop(); +void MQTTAsync_stop(void); int MQTTAsync_disconnect_internal(MQTTAsync handle, int timeout); void MQTTAsync_closeOnly(Clients* client); void MQTTAsync_closeSession(Clients* client); @@ -932,7 +932,7 @@ void MQTTAsync_checkDisconnect(MQTTAsync handle, MQTTAsync_command* command) * Cleaning up means removing any publication data that was stored because the write did * not originally complete. */ -void MQTTProtocol_checkPendingWrites() +void MQTTProtocol_checkPendingWrites(void) { FUNC_ENTRY; if (state.pending_writes.count > 0) @@ -1056,7 +1056,7 @@ void MQTTAsync_writeComplete(int socket) } -int MQTTAsync_processCommand() +int MQTTAsync_processCommand(void) { int rc = 0; MQTTAsync_queuedCommand* command = NULL; @@ -1302,7 +1302,7 @@ exit: } -void MQTTAsync_checkTimeouts() +void MQTTAsync_checkTimeouts(void) { ListElement* current = NULL; static time_t last = 0L; @@ -1888,7 +1888,7 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n) } -void MQTTAsync_stop() +void MQTTAsync_stop(void) { int rc = 0; @@ -3129,7 +3129,7 @@ void MQTTAsync_setTraceCallback(MQTTAsync_traceCallback* callback) } -MQTTAsync_nameValue* MQTTAsync_getVersionInfo() +MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void) { #define MAX_INFO_STRINGS 8 static MQTTAsync_nameValue libinfo[MAX_INFO_STRINGS + 1]; diff --git a/src/MQTTAsync.h b/src/MQTTAsync.h index fc977de4..2311c817 100644 --- a/src/MQTTAsync.h +++ b/src/MQTTAsync.h @@ -1102,7 +1102,7 @@ typedef struct * MQTTASYNC_TRACE_MINIMUM * @return an array of strings describing the library. The last entry is a NULL pointer. */ -DLLExport MQTTAsync_nameValue* MQTTAsync_getVersionInfo(); +DLLExport MQTTAsync_nameValue* MQTTAsync_getVersionInfo(void); /** diff --git a/src/MQTTClient.c b/src/MQTTClient.c index 6829655d..b0a42ca6 100644 --- a/src/MQTTClient.c +++ b/src/MQTTClient.c @@ -131,7 +131,7 @@ static mutex_type unsubscribe_mutex = &unsubscribe_mutex_store; static pthread_mutex_t connect_mutex_store = PTHREAD_MUTEX_INITIALIZER; static mutex_type connect_mutex = &connect_mutex_store; -void MQTTClient_init() +void MQTTClient_init(void) { pthread_mutexattr_t attr; int rc; @@ -163,7 +163,7 @@ static thread_id_type run_id = 0; MQTTPacket* MQTTClient_waitfor(MQTTClient handle, int packet_type, int* rc, long timeout); MQTTPacket* MQTTClient_cycle(int* sock, unsigned long timeout, int* rc); int MQTTClient_cleanSession(Clients* client); -void MQTTClient_stop(); +void MQTTClient_stop(void); int MQTTClient_disconnect_internal(MQTTClient handle, int timeout); int MQTTClient_disconnect1(MQTTClient handle, int timeout, int internal, int stop); void MQTTClient_writeComplete(int socket); @@ -629,7 +629,7 @@ thread_return_type WINAPI MQTTClient_run(void* n) } -void MQTTClient_stop() +void MQTTClient_stop(void) { int rc = 0; @@ -1930,7 +1930,7 @@ exit: return rc; } -MQTTClient_nameValue* MQTTClient_getVersionInfo() +MQTTClient_nameValue* MQTTClient_getVersionInfo(void) { #define MAX_INFO_STRINGS 8 static MQTTClient_nameValue libinfo[MAX_INFO_STRINGS + 1]; @@ -1971,7 +1971,7 @@ MQTTClient_nameValue* MQTTClient_getVersionInfo() * Cleaning up means removing any publication data that was stored because the write did * not originally complete. */ -void MQTTProtocol_checkPendingWrites() +void MQTTProtocol_checkPendingWrites(void) { FUNC_ENTRY; if (state.pending_writes.count > 0) diff --git a/src/SSLSocket.c b/src/SSLSocket.c index 3d1d6f1e..5ec775c9 100755 --- a/src/SSLSocket.c +++ b/src/SSLSocket.c @@ -393,7 +393,7 @@ extern void SSLLocks_callback(int mode, int n, const char *file, int line) } } -int SSLSocket_initialize() +int SSLSocket_initialize(void) { int rc = 0; /*int prc;*/ @@ -444,7 +444,7 @@ exit: return rc; } -void SSLSocket_terminate() +void SSLSocket_terminate(void) { FUNC_ENTRY; EVP_cleanup(); @@ -806,7 +806,7 @@ void SSLSocket_addPendingRead(int sock) } -int SSLSocket_getPendingRead() +int SSLSocket_getPendingRead(void) { int sock = -1; diff --git a/src/SSLSocket.h b/src/SSLSocket.h index e659ed2d..830b3dbb 100755 --- a/src/SSLSocket.h +++ b/src/SSLSocket.h @@ -31,8 +31,8 @@ #define URI_SSL "ssl://" -int SSLSocket_initialize(); -void SSLSocket_terminate(); +int SSLSocket_initialize(void); +void SSLSocket_terminate(void); int SSLSocket_setSocketForSSL(networkHandles* net, MQTTClient_SSLOptions* opts, char* hostname); int SSLSocket_getch(SSL* ssl, int socket, char* c); char *SSLSocket_getdata(SSL* ssl, int socket, size_t bytes, size_t* actual_len); @@ -41,7 +41,7 @@ int SSLSocket_close(networkHandles* net); int SSLSocket_putdatas(SSL* ssl, int socket, char* buf0, size_t buf0len, int count, char** buffers, size_t* buflens, int* frees); int SSLSocket_connect(SSL* ssl, int socket); -int SSLSocket_getPendingRead(); +int SSLSocket_getPendingRead(void); int SSLSocket_continueWrite(pending_writes* pw); #endif diff --git a/src/Socket.c b/src/Socket.c index 536fb054..2c7563c8 100755 --- a/src/Socket.c +++ b/src/Socket.c @@ -109,7 +109,7 @@ int Socket_error(char* aString, int sock) /** * Initialize the socket module */ -void Socket_outInitialize() +void Socket_outInitialize(void) { #if defined(WIN32) || defined(WIN64) WORD winsockVer = 0x0202; @@ -138,7 +138,7 @@ void Socket_outInitialize() /** * Terminate the socket module */ -void Socket_outTerminate() +void Socket_outTerminate(void) { FUNC_ENTRY; ListFree(s.connect_pending); diff --git a/src/Thread.c b/src/Thread.c index 6741accc..e05cacab 100644 --- a/src/Thread.c +++ b/src/Thread.c @@ -81,7 +81,7 @@ thread_type Thread_start(thread_fn fn, void* parameter) * Create a new mutex * @return the new mutex */ -mutex_type Thread_create_mutex() +mutex_type Thread_create_mutex(void) { mutex_type mutex = NULL; int rc = 0; @@ -166,7 +166,7 @@ void Thread_destroy_mutex(mutex_type mutex) * Get the thread id of the thread from which this function is called * @return thread id, type varying according to OS */ -thread_id_type Thread_getid() +thread_id_type Thread_getid(void) { #if defined(WIN32) || defined(WIN64) return GetCurrentThreadId(); @@ -194,7 +194,7 @@ static struct * Create a new semaphore * @return the new condition variable */ -sem_type Thread_create_sem() +sem_type Thread_create_sem(void) { sem_type sem = NULL; int rc = 0; @@ -364,7 +364,7 @@ int Thread_destroy_sem(sem_type sem) * Create a new condition variable * @return the condition variable struct */ -cond_type Thread_create_cond() +cond_type Thread_create_cond(void) { cond_type condvar = NULL; int rc = 0; diff --git a/src/Thread.h b/src/Thread.h index 6da5ab48..fa4266d0 100644 --- a/src/Thread.h +++ b/src/Thread.h @@ -40,7 +40,7 @@ typedef cond_type_struct *cond_type; typedef sem_t *sem_type; - cond_type Thread_create_cond(); + cond_type Thread_create_cond(void); int Thread_signal_cond(cond_type); int Thread_wait_cond(cond_type condvar, int timeout); int Thread_destroy_cond(cond_type); @@ -48,14 +48,14 @@ thread_type Thread_start(thread_fn, void*); -mutex_type Thread_create_mutex(); +mutex_type Thread_create_mutex(void); int Thread_lock_mutex(mutex_type); int Thread_unlock_mutex(mutex_type); void Thread_destroy_mutex(mutex_type); -thread_id_type Thread_getid(); +thread_id_type Thread_getid(void); -sem_type Thread_create_sem(); +sem_type Thread_create_sem(void); int Thread_wait_sem(sem_type sem, int timeout); int Thread_check_sem(sem_type sem); int Thread_post_sem(sem_type sem); diff --git a/test/sync_client_test.c b/test/sync_client_test.c index 31c776d3..16b4e9f7 100644 --- a/test/sync_client_test.c +++ b/test/sync_client_test.c @@ -69,7 +69,7 @@ struct Options }; -void usage() +void usage(void) { printf("options:\n connection, clientid1, clientid2, username, password, MQTTversion, iterations, verbose\n"); exit(-1); @@ -284,7 +284,7 @@ int messageArrived(void* context, char* topicName, int topicLen, MQTTClient_mess } -void clearMessages() +void clearMessages(void) { int i; @@ -296,7 +296,7 @@ void clearMessages() messageCount = 0; } -void cleanup() +void cleanup(void) { // clean all client state char* clientids[] = {options.clientid1, options.clientid2}; @@ -365,7 +365,7 @@ void cleanup() } -int basic_test() +int basic_test(void) { int i, rc; MQTTClient_connectOptions opts = MQTTClient_connectOptions_initializer; @@ -428,7 +428,7 @@ int basic_test() -int offline_message_queueing_test() +int offline_message_queueing_test(void) { int i, rc; MQTTClient_connectOptions opts = MQTTClient_connectOptions_initializer; @@ -505,7 +505,7 @@ int offline_message_queueing_test() } -int retained_message_test() +int retained_message_test(void) { int i, rc; MQTTClient_connectOptions opts = MQTTClient_connectOptions_initializer; @@ -674,7 +674,7 @@ typedef struct } MQTTClients; -int will_message_test() +int will_message_test(void) { int i, rc, count = 0; MQTTClient_connectOptions opts = MQTTClient_connectOptions_initializer; @@ -740,7 +740,7 @@ int will_message_test() } -int overlapping_subscriptions_test() +int overlapping_subscriptions_test(void) { /* overlapping subscriptions. When there is more than one matching subscription for the same client for a topic, the server may send back one message with the highest QoS of any matching subscription, or one message for @@ -806,7 +806,7 @@ int overlapping_subscriptions_test() } -int keepalive_test() +int keepalive_test(void) { /* keepalive processing. We should be kicked off by the server if we don't send or receive any data, and don't send any pings either. */ @@ -870,7 +870,7 @@ int keepalive_test() -int redelivery_on_reconnect_test() +int redelivery_on_reconnect_test(void) { /* redelivery on reconnect. When a QoS 1 or 2 exchange has not been completed, the server should retry the appropriate MQTT packets */ @@ -932,7 +932,7 @@ int redelivery_on_reconnect_test() -int zero_length_clientid_test() +int zero_length_clientid_test(void) { int i, rc, count = 0; MQTTClient_connectOptions opts = MQTTClient_connectOptions_initializer; @@ -971,7 +971,7 @@ int zero_length_clientid_test() } -int dollar_topics_test() +int dollar_topics_test(void) { /* $ topics. The specification says that a topic filter which starts with a wildcard does not match topic names that begin with a $. Publishing to a topic which starts with a $ may not be allowed on some servers (which is entirely valid), @@ -1028,7 +1028,7 @@ int dollar_topics_test() } -int subscribe_failure_test() +int subscribe_failure_test(void) { /* Subscribe failure. A new feature of MQTT 3.1.1 is the ability to send back negative reponses to subscribe requests. One way of doing this is to subscribe to a topic which is not allowed to be subscribed to. diff --git a/test/test1.c b/test/test1.c index 141d6dae..581e92c3 100644 --- a/test/test1.c +++ b/test/test1.c @@ -52,7 +52,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -245,7 +245,7 @@ char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test2.c b/test/test2.c index 71ce135a..96399168 100644 --- a/test/test2.c +++ b/test/test2.c @@ -46,7 +46,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -239,7 +239,7 @@ char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test3.c b/test/test3.c index a6fc2911..114f9749 100644 --- a/test/test3.c +++ b/test/test3.c @@ -63,7 +63,7 @@ char* persistenceStore = NULL; #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("Options:\n"); printf("\t--test_no - Run test number \n"); @@ -359,7 +359,7 @@ char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test4.c b/test/test4.c index c2d51378..87a993ca 100644 --- a/test/test4.c +++ b/test/test4.c @@ -46,7 +46,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -222,7 +222,7 @@ START_TIME_TYPE global_start_time; char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test5.c b/test/test5.c index 9502434a..12c02cd9 100644 --- a/test/test5.c +++ b/test/test5.c @@ -51,7 +51,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("Options:\n"); printf("\t--test_no - Run test number \n"); @@ -278,7 +278,7 @@ char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test6.c b/test/test6.c index 8ddd13ce..22c842c9 100644 --- a/test/test6.c +++ b/test/test6.c @@ -38,7 +38,7 @@ #include #endif -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -499,7 +499,7 @@ void connectionLost(void* context, char* cause) } -int recreateReconnect() +int recreateReconnect(void) { int rc; @@ -608,7 +608,7 @@ void messageSent(void* context, MQTTAsync_successData* response) } -void one_iteration() +void one_iteration(void) { int interval = 0; int i = 0; diff --git a/test/test8.c b/test/test8.c index 4ea35641..37a96b90 100644 --- a/test/test8.c +++ b/test/test8.c @@ -46,7 +46,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); diff --git a/test/test9.c b/test/test9.c index e17cb232..169d358a 100644 --- a/test/test9.c +++ b/test/test9.c @@ -48,7 +48,7 @@ char unique[50]; // unique suffix/prefix to add to clientid/topic etc #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -200,7 +200,7 @@ char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test_mqtt4async.c b/test/test_mqtt4async.c index 603abd55..6f84b904 100644 --- a/test/test_mqtt4async.c +++ b/test/test_mqtt4async.c @@ -52,7 +52,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -234,7 +234,7 @@ char* cur_output = output; int test_finished = 0; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time); diff --git a/test/test_mqtt4sync.c b/test/test_mqtt4sync.c index b6bae8da..d76ebd75 100644 --- a/test/test_mqtt4sync.c +++ b/test/test_mqtt4sync.c @@ -52,7 +52,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -void usage() +void usage(void) { printf("help!!\n"); exit(-1); @@ -233,7 +233,7 @@ char output[3000]; char* cur_output = output; -void write_test_result() +void write_test_result(void) { long duration = elapsed(global_start_time);