Skip to content

Commit

Permalink
fixup clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
jiridanek committed Mar 30, 2023
1 parent 4e69af4 commit a405d3d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
4 changes: 2 additions & 2 deletions include/qpid/dispatch/threading.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
* Threading and locking API.
*/

#include <pthread.h>

#include "qpid/dispatch/internal/thread_annotations.h"

#include <pthread.h>

typedef struct sys_mutex_t TA_CAP("mutex") sys_mutex_t;
struct sys_mutex_t {
pthread_mutex_t mutex;
Expand Down
3 changes: 2 additions & 1 deletion src/entity_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
24 changes: 15 additions & 9 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions src/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <proton/object.h>

Expand Down

0 comments on commit a405d3d

Please sign in to comment.