Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
model-checker : add stats in mmalloc
[simgrid.git] / src / xbt / xbt_peer.c
index 730fb2f..919f51d 100644 (file)
@@ -1,8 +1,7 @@
-/* $Id$ */
-
 /* xbt_peer_t management functions                                          */
 
-/* Copyright (c) 2006 Martin Quinson. All rights reserved.                  */
+/* Copyright (c) 2006, 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -22,6 +21,7 @@ xbt_peer_t xbt_peer_new(const char *name, int port)
   return res;
 }
 
+/** \brief copy constructor */
 xbt_peer_t xbt_peer_copy(xbt_peer_t h)
 {
   return xbt_peer_new(h->name, h->port);
@@ -33,7 +33,7 @@ xbt_peer_t xbt_peer_from_string(const char *peerport)
   xbt_peer_t res = xbt_new(s_xbt_peer_t, 1);
   char *name = xbt_strdup(peerport);
   char *port_str = strchr(name, ':');
-  xbt_assert1(port_str,
+  xbt_assert(port_str,
               "argument of xbt_peer_from_string should be of form <peername>:<port>, it's '%s'",
               peerport);
   *port_str = '\0';
@@ -49,8 +49,7 @@ xbt_peer_t xbt_peer_from_string(const char *peerport)
 void xbt_peer_free(xbt_peer_t peer)
 {
   if (peer) {
-    if (peer->name)
-      free(peer->name);
+    free(peer->name);
     free(peer);
   }
 }