From a405d3d5c5af80a30c073a4e40ed8d254a5a8e52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Thu, 30 Mar 2023 17:27:14 +0200 Subject: [PATCH] fixup clang-format --- include/qpid/dispatch/threading.h | 4 ++-- src/entity_cache.c | 3 ++- src/log.c | 24 +++++++++++++++--------- src/message.c | 4 ++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/include/qpid/dispatch/threading.h b/include/qpid/dispatch/threading.h index 18bd98ffe..b0aa2f8b9 100644 --- a/include/qpid/dispatch/threading.h +++ b/include/qpid/dispatch/threading.h @@ -23,10 +23,10 @@ * Threading and locking API. */ -#include - #include "qpid/dispatch/internal/thread_annotations.h" +#include + typedef struct sys_mutex_t TA_CAP("mutex") sys_mutex_t; struct sys_mutex_t { pthread_mutex_t mutex; diff --git a/src/entity_cache.c b/src/entity_cache.c index ae12e0289..4810ae81d 100644 --- a/src/entity_cache.c +++ b/src/entity_cache.c @@ -84,7 +84,8 @@ void qd_entity_cache_remove(const char *type, void *object) { push_event(REMOVE, // Locks the entity cache so entities can be updated safely (prevent entities from being deleted.) // Do not process any entities if return error code != 0 // Must call qd_entity_refresh_end when done, regardless of error code. -QD_EXPORT qd_error_t qd_entity_refresh_begin(PyObject *list) TA_ACQ(event_lock) TA_NO_THREAD_SAFETY_ANALYSIS { +QD_EXPORT qd_error_t qd_entity_refresh_begin(PyObject *list) TA_ACQ(event_lock) TA_NO_THREAD_SAFETY_ANALYSIS +{ qd_error_clear(); sys_mutex_lock(&event_lock); entity_event_t *event = DEQ_HEAD(event_list); diff --git a/src/log.c b/src/log.c index f85a9f398..9a2b97031 100644 --- a/src/log.c +++ b/src/log.c @@ -70,7 +70,8 @@ ALLOC_DEFINE(qd_log_entry_t); DEQ_DECLARE(qd_log_entry_t, qd_log_list_t); static qd_log_list_t entries = {0}; -static void qd_log_entry_free_lh(qd_log_entry_t* entry) TA_REQ(log_source_lock) { +static void qd_log_entry_free_lh(qd_log_entry_t *entry) TA_REQ(log_source_lock) +{ DEQ_REMOVE(entries, entry); free(entry->file); free(entry->module); @@ -114,14 +115,16 @@ static const char* SINK_STDERR = "stderr"; static const char* SINK_SYSLOG = "syslog"; static const char* SOURCE_DEFAULT = "DEFAULT"; -static log_sink_t* find_log_sink_lh(const char* name) TA_REQ(log_source_lock) { +static log_sink_t *find_log_sink_lh(const char *name) TA_REQ(log_source_lock) +{ log_sink_t* sink = DEQ_HEAD(sink_list); DEQ_FIND(sink, strcmp(sink->name, name) == 0); return sink; } // Must hold the log_source_lock -static void log_sink_free_lh(log_sink_t* sink) TA_REQ(log_source_lock) { +static void log_sink_free_lh(log_sink_t *sink) TA_REQ(log_source_lock) +{ if (!sink) return; assert(sink->ref_count); @@ -136,7 +139,8 @@ static void log_sink_free_lh(log_sink_t* sink) TA_REQ(log_source_lock) { } } -static log_sink_t* log_sink_lh(const char* name) TA_REQ(log_source_lock) { +static log_sink_t *log_sink_lh(const char *name) TA_REQ(log_source_lock) +{ log_sink_t* sink = find_log_sink_lh(name); if (sink) { sys_atomic_inc(&sink->ref_count); @@ -293,7 +297,7 @@ static int enable_mask(const char *enable_) { } /// Caller must hold log_source_lock -static qd_log_source_t* lookup_log_source_lh(const char *module) TA_REQ(log_source_lock) +static qd_log_source_t *lookup_log_source_lh(const char *module) TA_REQ(log_source_lock) { if (strcasecmp(module, SOURCE_DEFAULT) == 0) return default_log_source; @@ -354,7 +358,8 @@ static void write_log(qd_log_source_t *log_source, qd_log_entry_t *entry) } /// Reset the log source to the default state -static void qd_log_source_defaults(qd_log_source_t *log_source) TA_REQ(log_source_lock) { +static void qd_log_source_defaults(qd_log_source_t *log_source) TA_REQ(log_source_lock) +{ log_source->mask = -1; log_source->includeTimestamp = -1; log_source->includeSource = -1; @@ -396,7 +401,8 @@ qd_log_source_t *qd_log_source_reset(const char *module) return src; } -static void qd_log_source_free_lh(qd_log_source_t* src) TA_REQ(log_source_lock) { +static void qd_log_source_free_lh(qd_log_source_t *src) TA_REQ(log_source_lock) +{ DEQ_REMOVE(source_list, src); log_sink_free_lh(src->sink); free(src->module); @@ -528,8 +534,8 @@ void qd_log_initialize(void) TA_NO_THREAD_SAFETY_ANALYSIS default_log_source->sink = log_sink_lh(SINK_STDERR); } - -void qd_log_finalize(void) TA_NO_THREAD_SAFETY_ANALYSIS { +void qd_log_finalize(void) TA_NO_THREAD_SAFETY_ANALYSIS +{ while (DEQ_HEAD(source_list)) qd_log_source_free_lh(DEQ_HEAD(source_list)); while (DEQ_HEAD(entries)) diff --git a/src/message.c b/src/message.c index 93d99b892..f0a6b3acc 100644 --- a/src/message.c +++ b/src/message.c @@ -20,20 +20,20 @@ #include "qpid/dispatch/message.h" #include "aprintf.h" +#include "buffer_field_api.h" #include "compose_private.h" #include "connection_manager_private.h" #include "message_private.h" #include "policy.h" -#include "buffer_field_api.h" #include "qpid/dispatch/amqp.h" #include "qpid/dispatch/ctools.h" +#include "qpid/dispatch/discriminator.h" #include "qpid/dispatch/error.h" #include "qpid/dispatch/internal/thread_annotations.h" #include "qpid/dispatch/iterator.h" #include "qpid/dispatch/log.h" #include "qpid/dispatch/threading.h" -#include "qpid/dispatch/discriminator.h" #include