return event;
}
+struct event *
+event_add_int_nonzero(struct event *event, const char *key, intmax_t num)
+{
+ if (num != 0)
+ return event_add_int(event, key, num);
+ return event;
+}
+
struct event *
event_inc_int(struct event *event, const char *key, intmax_t num)
{
return &event_passthrough_vfuncs;
}
+static struct event_passthrough *
+event_passthrough_add_int_nonzero(const char *key, intmax_t num)
+{
+ event_add_int_nonzero(last_passthrough_event(), key, num);
+ return &event_passthrough_vfuncs;
+}
+
static struct event_passthrough *
event_passthrough_add_timeval(const char *key, const struct timeval *tv)
{
.add_fields = event_passthrough_add_fields,
.add_str = event_passthrough_add_str,
.add_int = event_passthrough_add_int,
+ .add_int_nonzero = event_passthrough_add_int_nonzero,
.add_timeval = event_passthrough_add_timeval,
.inc_int = event_passthrough_inc_int,
.strlist_append = event_passthrough_strlist_append,
(*add_str)(const char *key, const char *value);
struct event_passthrough *
(*add_int)(const char *key, intmax_t num);
+ struct event_passthrough *
+ (*add_int_nonzero)(const char *key, intmax_t num);
struct event_passthrough *
(*add_timeval)(const char *key, const struct timeval *tv);
event_add_str(struct event *event, const char *key, const char *value);
struct event *
event_add_int(struct event *event, const char *key, intmax_t num);
+/* Adds int value to event if it is non-zero */
+struct event *
+event_add_int_nonzero(struct event *event, const char *key, intmax_t num);
/* Increase the key's value. If it's not set or isn't an integer type,
initialize the value to num. */
struct event *