Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Some (trivial) helping functions around xbt_host_t
[simgrid.git] / src / xbt / xbt_host.c
1 /* $Id$ */
2
3 /* xbt_host_t management functions                                          */
4
5 /* Copyright (c) 2006 Martin Quinson. All rights reserved.                  */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "xbt/sysdep.h"
11 #include "xbt/log.h"
12 #include "xbt/host.h"
13
14 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(host,xbt,"Host management");
15
16 /** \brief constructor */
17 xbt_host_t xbt_host_new(char *name, int port)  {
18    xbt_host_t res=xbt_new(s_xbt_host_t, 1);
19    res->name = name;
20    res->port = port;
21    return res;
22 }
23
24 /** \brief destructor */
25 void xbt_host_free(xbt_host_t host) {
26    if (host) {
27       if (host->name) free(host->name);
28       free(host);
29    }
30 }
31
32 /** \brief Freeing function for dynars of xbt_host_t */
33 void xbt_host_free_voidp(void *d) {
34    xbt_host_free( (xbt_host_t) *(void**)d );
35 }