Ejemplo n.º 1
0
void add_master_done (void) {
	if (master_history_addr) {
		history_free (master_history_addr);
		master_history_addr = NULL;
	}
	if (master_history_name) {
		history_free (master_history_name);
		master_history_name = NULL;
	}
}
Ejemplo n.º 2
0
/**
 * Expires any HistoryNode's who's time is older than max_age seconds ago.
 * 
 * Note: When an entry is re
 * @param h History to expire
 */
void history_expire(struct History *h) {
    // The time before which a HistoryNode is to be expired
    time_t retirement;
    time(&retirement);
    retirement = retirement - h->max_age;
    
    while (list_isNode(h->list.l_head) && ((struct HistoryNode *) h->list.l_head)->time < retirement)
        history_free(h, (struct HistoryNode *) list_removeHead(&h->list));
}
Ejemplo n.º 3
0
void model_config_select_refcase_history( model_config_type * model_config , const ecl_sum_type * refcase , bool use_history) {
  if (model_config->history != NULL)
    history_free( model_config->history );

  if (refcase != NULL) {
    model_config->history = history_alloc_from_refcase( refcase , use_history );  
    model_config->history_source = SCHEDULE;
  } else
    util_abort("%s: internal error - trying to load history from REFCASE - but no REFCASE has been loaded.\n",__func__);
}
Ejemplo n.º 4
0
void model_config_select_schedule_history( model_config_type * model_config , const sched_file_type * sched_file) {
  if (model_config->history != NULL)
    history_free( model_config->history );
  
  if (sched_file != NULL) {
    model_config->history = history_alloc_from_sched_file( SUMMARY_KEY_JOIN_STRING , sched_file);  
    model_config->history_source = SCHEDULE;
  } else
    util_abort("%s: internal error - trying to select HISTORY_SOURCE:SCHEDULE - but no Schedule file has been loaded.\n",__func__);
}
Ejemplo n.º 5
0
void model_config_free(model_config_type * model_config) {
  if (model_config->enkf_sched != NULL)
    enkf_sched_free( model_config->enkf_sched );
  free( model_config->enspath );
  free( model_config->rftpath );
  util_safe_free( model_config->jobname_fmt );
  util_safe_free( model_config->enkf_sched_file );
  util_safe_free( model_config->select_case );
  util_safe_free( model_config->case_table_file );
  util_safe_free( model_config->current_path_key);

  if (model_config->history != NULL)
    history_free(model_config->history);

  if (model_config->forward_model != NULL)
    forward_model_free(model_config->forward_model);

  bool_vector_free(model_config->internalize_state);
  bool_vector_free(model_config->__load_state);
  hash_free(model_config->runpath_map);
  if (model_config->case_names != NULL) stringlist_free( model_config->case_names );
  free(model_config);
}
Ejemplo n.º 6
0
void
kill_session_callback (session * killsess)
{
	server *killserv = killsess->server;
	session *sess;
	GSList *list;

	plugin_emit_dummy_print (killsess, "Close Context");

	if (current_tab == killsess)
		current_tab = NULL;

	if (killserv->server_session == killsess)
		killserv->server_session = NULL;

	if (killserv->front_session == killsess)
	{
		/* front_session is closed, find a valid replacement */
		killserv->front_session = NULL;
		list = sess_list;
		while (list)
		{
			sess = (session *) list->data;
			if (sess != killsess && sess->server == killserv)
			{
				killserv->front_session = sess;
				if (!killserv->server_session)
					killserv->server_session = sess;
				break;
			}
			list = list->next;
		}
	}

	if (!killserv->server_session)
		killserv->server_session = killserv->front_session;

	sess_list = g_slist_remove (sess_list, killsess);

	if (killsess->type == SESS_CHANNEL)
		free_userlist (killsess);

	exec_notify_kill (killsess);

	log_close (killsess);

	send_quit_or_part (killsess);

	history_free (&killsess->history);
	if (killsess->topic)
		free (killsess->topic);
	if (killsess->current_modes)
		free (killsess->current_modes);

	fe_session_callback (killsess);

	if (current_sess == killsess && sess_list)
		current_sess = sess_list->data;

	free (killsess);

	if (!sess_list && !in_xchat_exit)
		xchat_exit ();						/* sess_list is empty, quit! */

	list = sess_list;
	while (list)
	{
		sess = (session *) list->data;
		if (sess->server == killserv)
			return;					  /* this server is still being used! */
		list = list->next;
	}

	kill_server_callback (killserv);
}
Ejemplo n.º 7
0
void
session_free (session *killsess)
{
	server *killserv = killsess->server;
	session *sess;
	GSList *list;
	int oldidx;

	plugin_emit_dummy_print (killsess, "Close Context");

	if (current_tab == killsess)
		current_tab = NULL;

	if (killserv->server_session == killsess)
		killserv->server_session = NULL;

	if (killserv->front_session == killsess)
	{
		/* front_session is closed, find a valid replacement */
		killserv->front_session = NULL;
		list = sess_list;
		while (list)
		{
			sess = (session *) list->data;
			if (sess != killsess && sess->server == killserv)
			{
				killserv->front_session = sess;
				if (!killserv->server_session)
					killserv->server_session = sess;
				break;
			}
			list = list->next;
		}
	}

	if (!killserv->server_session)
		killserv->server_session = killserv->front_session;

	sess_list = g_slist_remove (sess_list, killsess);

	if (killsess->type == SESS_CHANNEL)
		userlist_free (killsess);

	oldidx = killsess->lastact_idx;
	if (oldidx != LACT_NONE)
		sess_list_by_lastact[oldidx] = g_list_remove(sess_list_by_lastact[oldidx], killsess);

	exec_notify_kill (killsess);

	log_close (killsess);
	scrollback_close (killsess);
	chanopt_save (killsess);

	send_quit_or_part (killsess);

	history_free (&killsess->history);
	if (killsess->topic)
		free (killsess->topic);
	if (killsess->current_modes)
		free (killsess->current_modes);

	fe_session_callback (killsess);

	if (current_sess == killsess)
	{
		current_sess = NULL;
		if (sess_list)
			current_sess = sess_list->data;
	}

	free (killsess);

	if (!sess_list && !in_hexchat_exit)
		hexchat_exit ();						/* sess_list is empty, quit! */

	list = sess_list;
	while (list)
	{
		sess = (session *) list->data;
		if (sess->server == killserv)
			return;					  /* this server is still being used! */
		list = list->next;
	}

	server_free (killserv);
}
Ejemplo n.º 8
0
void
session_free (session *killsess)
{
	server *killserv = killsess->server;
	session *sess;
	GSList *list;

	if (current_tab == killsess)
		current_tab = NULL;

	if (killserv->server_session == killsess)
		killserv->server_session = NULL;

	if (killserv->front_session == killsess)
	{
		/* front_session is closed, find a valid replacement */
		killserv->front_session = NULL;
		list = sess_list;
		while (list)
		{
			sess = (session *) list->data;
			if (sess != killsess && sess->server == killserv)
			{
				killserv->front_session = sess;
				if (!killserv->server_session)
					killserv->server_session = sess;
				break;
			}
			list = list->next;
		}
	}

	if (!killserv->server_session)
		killserv->server_session = killserv->front_session;

	sess_list = g_slist_remove (sess_list, killsess);

	signal_emit("session destroy", 1, killsess);

	if (killsess->type == SESS_CHANNEL)
		userlist_free (killsess);

	log_close (killsess);
	scrollback_close (killsess);

	send_quit_or_part (killsess);

	history_free (&killsess->history);
	if (killsess->topic)
		free (killsess->topic);
	if (killsess->current_modes)
		free (killsess->current_modes);

	fe_session_callback (killsess);

	if (current_sess == killsess)
	{
		current_sess = NULL;
		if (sess_list)
			current_sess = sess_list->data;
	}

	if (killsess->lastact_elem)
	{
		if (killsess->lastact_idx != LACT_NONE)
			sess_list_by_lastact[killsess->lastact_idx] = g_list_delete_link(sess_list_by_lastact[killsess->lastact_idx], killsess->lastact_elem);
		else
			g_list_free_1(killsess->lastact_elem);
	}

	free (killsess);

	if (!sess_list && !in_xchat_exit)
		xchat_exit ();						/* sess_list is empty, quit! */

	list = sess_list;
	while (list)
	{
		sess = (session *) list->data;
		if (sess->server == killserv)
			return;					  /* this server is still being used! */
		list = list->next;
	}

	server_free (killserv);
}