Пример #1
0
void try_outgoing_connections(void) {
	static config_t *cfg = NULL;
	char *name;
	outgoing_t *outgoing;
	
	outgoing_list = list_alloc((list_action_t)free_outgoing);
			
	for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
		get_config_string(cfg, &name);

		if(!check_id(name)) {
			logger(LOG_ERR,
				   "Invalid name for outgoing connection in %s line %d",
				   cfg->file, cfg->line);
			free(name);
			continue;
		}

		outgoing = xmalloc_and_zero(sizeof(*outgoing));
		outgoing->name = name;
		list_insert_tail(outgoing_list, outgoing);
		setup_outgoing_connection(outgoing);
	}
}
Пример #2
0
    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "system.h"

#include "list.h"
#include "xalloc.h"

/* (De)constructors */

list_t *list_alloc(list_action_t delete) {
	list_t *list;

	list = xmalloc_and_zero(sizeof(list_t));
	list->delete = delete;

	return list;
}

void list_free(list_t *list) {
	free(list);
}

list_node_t *list_alloc_node(void) {
	return xmalloc_and_zero(sizeof(list_node_t));
}

void list_free_node(list_t *list, list_node_t *node) {
	if(node->data && list->delete)
Пример #3
0
config_t *new_config(void) {
	return xmalloc_and_zero(sizeof(config_t));
}
Пример #4
0
BN_GENCB *BN_GENCB_new(void) {
	return xmalloc_and_zero(sizeof(BN_GENCB));
}
Пример #5
0
subnet_t *new_subnet(void) {
	return xmalloc_and_zero(sizeof(subnet_t));
}
Пример #6
0
					greatgrandparent->left = node;
				else
					greatgrandparent->right = node;
			}
		}
	}

	tree->root = node;
}

/* (De)constructors */

splay_tree_t *splay_alloc_tree(splay_compare_t compare, splay_action_t delete) {
	splay_tree_t *tree;

	tree = xmalloc_and_zero(sizeof(splay_tree_t));
	tree->compare = compare;
	tree->delete = delete;

	return tree;
}

void splay_free_tree(splay_tree_t *tree) {
	free(tree);
}

splay_node_t *splay_alloc_node(void) {
	return xmalloc_and_zero(sizeof(splay_node_t));
}

void splay_free_node(splay_tree_t *tree, splay_node_t *node) {