void stumpless_close_buffer_target( struct stumpless_target *target ) { clear_error( ); if( !target ) { raise_argument_empty( "target is NULL" ); return; } destroy_buffer_target( target->id ); destroy_target( target ); }
struct stumpless_target * stumpless_open_buffer_target( const char *name, char *buffer, size_t size, int options, int default_facility ) { struct stumpless_target *target; clear_error( ); if( !name ) { raise_argument_empty( "name is NULL" ); return NULL; } if( !buffer ) { raise_argument_empty( "buffer is NULL" ); return NULL; } target = new_target( STUMPLESS_BUFFER_TARGET, name, options, default_facility ); if( !target ) { goto fail; } target->id = new_buffer_target( buffer, size ); if( !target->id ) { goto fail_id; } stumpless_set_current_target( target ); return target; fail_id: destroy_target( target ); fail: return NULL; }
void clear_config (struct mc_config *MC, int do_destroy_targets) { int i, j; for (i = 0; i < MC->clusters_num; i++) { struct mc_cluster *C = &MC->Clusters[i]; if (do_destroy_targets) { for (j = 0; j < C->tot_buckets; j++) { vkprintf (1, "destroying target %s:%d\n", inet_ntoa (C->buckets[j]->target), C->buckets[j]->port); destroy_target (C->buckets[j]); } memset (C->buckets, 0, C->tot_buckets * sizeof (struct conn_target *)); } if (C->points) { free (C->points); C->points = 0; } if (C->cluster_name) { zfree (C->cluster_name, strlen (C->cluster_name) + 1); C->cluster_name = 0; } } MC->ConfigServersCount = 0; MC->clusters_num = 0; }