ContextInfoDB * context_info_db_ref(ContextInfoDB *self) { g_assert(!self || g_atomic_counter_get(&self->ref_cnt) > 0); g_atomic_counter_inc(&self->ref_cnt); return self; }
void context_info_db_unref(ContextInfoDB *self) { g_assert(!self || g_atomic_counter_get(&self->ref_cnt)); if (g_atomic_counter_dec_and_test(&self->ref_cnt)) { context_info_db_free(self); } }
LogPipe * log_pipe_ref(LogPipe *self) { g_assert(!self || g_atomic_counter_get(&self->ref_cnt) > 0); if (self) { g_atomic_counter_inc(&self->ref_cnt); } return self; }
void log_pipe_unref(LogPipe *self) { g_assert(!self || g_atomic_counter_get(&self->ref_cnt)); if (self && (g_atomic_counter_dec_and_test(&self->ref_cnt))) { if (self->free_fn) self->free_fn(self); g_free(self); } }
void log_source_set_options(LogSource *self, LogSourceOptions *options, gint stats_level, gint stats_source, const gchar *stats_id, const gchar *stats_instance, gboolean threaded, gboolean pos_tracked) { /* NOTE: we don't adjust window_size even in case it was changed in the * configuration and we received a SIGHUP. This means that opened * connections will not have their window_size changed. */ if (g_atomic_counter_get(&self->window_size) == -1) g_atomic_counter_set(&self->window_size, options->init_window_size); self->options = options; self->stats_level = stats_level; self->stats_source = stats_source; if (self->stats_id) g_free(self->stats_id); self->stats_id = stats_id ? g_strdup(stats_id) : NULL; if (self->stats_instance) g_free(self->stats_instance); self->stats_instance = stats_instance ? g_strdup(stats_instance): NULL; self->threaded = threaded; self->pos_tracked = pos_tracked; _create_ack_tracker_if_not_exists(self, pos_tracked); }