void event_copy_categories(struct event *to, struct event *from)
{
unsigned int cat_count;
- struct event_category *const *categories = event_get_categories(from, &cat_count);
+ struct event_category *const *categories =
+ event_get_categories(from, &cat_count);
for (unsigned int i = 1; i <= cat_count; i++)
event_add_category(to, categories[cat_count-i]);
}
skip_bound = NULL;
for (; cur != NULL; cur = cur->parent) {
if (cur->sent_to_stats_id == 0 &&
- (!array_is_created(&cur->fields) || array_is_empty(&cur->fields)) &&
- (!array_is_created(&cur->categories) || array_is_empty(&cur->categories)))
+ (!array_is_created(&cur->fields) ||
+ array_is_empty(&cur->fields)) &&
+ (!array_is_created(&cur->categories) ||
+ array_is_empty(&cur->categories)))
continue;
skip_bound = cur;
if (!parent->passthrough) {
if (event_last_passthrough != NULL) {
/* API is being used in a wrong or dangerous way */
- i_panic("Can't create multiple passthrough events - finish the earlier with ->event()");
+ i_panic("Can't create multiple passthrough events - "
+ "finish the earlier with ->event()");
}
struct event *event =
event_create(parent, source_filename, source_linenum);
return NULL;
}
-static struct event_internal_category *event_category_find_internal(const char *name)
+static struct event_internal_category *
+event_category_find_internal(const char *name)
{
struct event_internal_category *const *internal;
return array_get(&event_registered_categories_representative, count_r);
}
-static void event_category_add_to_array(struct event_internal_category *internal)
+static void
+event_category_add_to_array(struct event_internal_category *internal)
{
struct event_category *representative = &internal->representative;
array_push_back(&event_registered_categories_internal, &internal);
- array_push_back(&event_registered_categories_representative, &representative);
+ array_push_back(&event_registered_categories_representative,
+ &representative);
}
-static struct event_category *event_category_register(struct event_category *category)
+static struct event_category *
+event_category_register(struct event_category *category)
{
struct event_internal_category *internal = category->internal;
event_category_callback_t *const *callbackp;
if ((category->parent != NULL) &&
(internal->parent != category->parent->internal)) {
/* case 4 */
- struct event_internal_category *other = category->parent->internal;
+ struct event_internal_category *other =
+ category->parent->internal;
i_panic("event category parent mismatch detected: "
"category %p internal %p (%s), "
category->internal = internal;
- if (!allocated)
- return &internal->representative; /* not the first registration of this category */
+ if (!allocated) {
+ /* not the first registration of this category */
+ return &internal->representative;
+ }
array_foreach(&event_category_callbacks, callbackp) T_BEGIN {
(*callbackp)(&internal->representative);
return dec2str(field->value.intmax);
case EVENT_FIELD_VALUE_TYPE_TIMEVAL:
return t_strdup_printf("%"PRIdTIME_T".%u",
- field->value.timeval.tv_sec,
- (unsigned int)field->value.timeval.tv_usec);
+ field->value.timeval.tv_sec,
+ (unsigned int)field->value.timeval.tv_usec);
}
i_unreached();
}
for (unsigned int i = 0; fields[i].key != NULL; i++) {
if (fields[i].value != NULL)
event_add_str(event, fields[i].key, fields[i].value);
- else if (fields[i].value_timeval.tv_sec != 0)
- event_add_timeval(event, fields[i].key, &fields[i].value_timeval);
- else
- event_add_int(event, fields[i].key, fields[i].value_intmax);
+ else if (fields[i].value_timeval.tv_sec != 0) {
+ event_add_timeval(event, fields[i].key,
+ &fields[i].value_timeval);
+ } else {
+ event_add_int(event, fields[i].key,
+ fields[i].value_intmax);
+ }
}
return event;
}
bool event_import(struct event *event, const char *str, const char **error_r)
{
- return event_import_unescaped(event, t_strsplit_tabescaped(str), error_r);
+ return event_import_unescaped(event, t_strsplit_tabescaped(str),
+ error_r);
}
static bool event_import_tv(const char *arg_secs, const char *arg_usecs,
break;
}
case EVENT_CODE_TV_LAST_SENT:
- if (!event_import_tv(arg, args[1], &event->tv_last_sent, &error)) {
- *error_r = t_strdup_printf("Invalid tv_last_sent: %s", error);
+ if (!event_import_tv(arg, args[1], &event->tv_last_sent,
+ &error)) {
+ *error_r = t_strdup_printf(
+ "Invalid tv_last_sent: %s", error);
return FALSE;
}
args++;
array_foreach(&event_handlers, callbackp) {
if (*callbackp == callback) {
- array_delete(&event_handlers,
- array_foreach_idx(&event_handlers, callbackp), 1);
+ unsigned int idx =
+ array_foreach_idx(&event_handlers, callbackp);
+ array_delete(&event_handlers, idx, 1);
return;
}
}
array_foreach(&event_category_callbacks, callbackp) {
if (*callbackp == callback) {
- array_delete(&event_category_callbacks,
- array_foreach_idx(&event_category_callbacks, callbackp), 1);
+ unsigned int idx =
+ array_foreach_idx(&event_category_callbacks,
+ callbackp);
+ array_delete(&event_category_callbacks, idx, 1);
return;
}
}
event_log_message_callback_t(void *context, enum log_type log_type,
const char *message);
-/* Returns TRUE if the event has all the categories that the "other" event has (and maybe more). */
+/* Returns TRUE if the event has all the categories that the "other" event has
+ (and maybe more). */
bool event_has_all_categories(struct event *event, const struct event *other);
-/* Returns TRUE if the event has all the fields that the "other" event has (and maybe more).
- Only the fields in the events themselves are checked. Parent events' fields are not checked. */
+/* Returns TRUE if the event has all the fields that the "other" event has
+ (and maybe more). Only the fields in the events themselves are checked.
+ Parent events' fields are not checked. */
bool event_has_all_fields(struct event *event, const struct event *other);
/* Returns the source event duplicated into a new event. Event pointers are
event_drop_parent_log_prefixes(struct event *event, unsigned int count);
/* Sets event prefix callback, sets log_prefix empty */
-struct event *event_set_log_prefix_callback(struct event *event,
- bool replace,
- event_log_prefix_callback_t *callback,
- void *context);
+struct event *
+event_set_log_prefix_callback(struct event *event, bool replace,
+ event_log_prefix_callback_t *callback,
+ void *context);
#define event_set_log_prefix_callback(event, replace, callback, context) \
event_set_log_prefix_callback(event, replace, \
(event_log_prefix_callback_t*)callback, TRUE ? context : \
CALLBACK_TYPECHECK(callback, const char *(*)(typeof(context))))
/* Sets event message amendment callback */
-struct event *event_set_log_message_callback(struct event *event,
- event_log_message_callback_t *callback,
- void *context);
+struct event *
+event_set_log_message_callback(struct event *event,
+ event_log_message_callback_t *callback,
+ void *context);
#define event_set_log_message_callback(event, callback, context) \
event_set_log_message_callback(event, \
(event_log_message_callback_t*)callback, TRUE ? context : \