Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reindent everything (possibly breaking all branches, but for the last time)
[simgrid.git] / src / xbt / xbt_peer.c
index 1d47f29..730fb2f 100644 (file)
 #include "xbt/log.h"
 #include "xbt/peer.h"
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(peer,xbt,"peer management");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(peer, xbt, "peer management");
 
 /** \brief constructor */
-xbt_peer_t xbt_peer_new(const char *name, int port)  {
-  xbt_peer_t res=xbt_new(s_xbt_peer_t, 1);
+xbt_peer_t xbt_peer_new(const char *name, int port)
+{
+  xbt_peer_t res = xbt_new(s_xbt_peer_t, 1);
   res->name = xbt_strdup(name);
   res->port = port;
   return res;
 }
 
-xbt_peer_t xbt_peer_copy(xbt_peer_t h) {
-  return xbt_peer_new(h->name,h->port);
+xbt_peer_t xbt_peer_copy(xbt_peer_t h)
+{
+  return xbt_peer_new(h->name, h->port);
 }
 
 /** \brief constructor. Argument should be of form '(peername):(port)'. */
-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,"argument of xbt_peer_from_string should be of form <peername>:<port>, it's '%s'", peerport);
-  *port_str='\0';
+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,
+              "argument of xbt_peer_from_string should be of form <peername>:<port>, it's '%s'",
+              peerport);
+  *port_str = '\0';
   port_str++;
 
   res->name = xbt_strdup(name); /* it will be shorter now that we cut the port */
@@ -41,14 +46,17 @@ xbt_peer_t xbt_peer_from_string(const char *peerport)  {
 }
 
 /** \brief destructor */
-void xbt_peer_free(xbt_peer_t peer) {
+void xbt_peer_free(xbt_peer_t peer)
+{
   if (peer) {
-    if (peer->name) free(peer->name);
+    if (peer->name)
+      free(peer->name);
     free(peer);
   }
 }
 
 /** \brief Freeing function for dynars of xbt_peer_t */
-void xbt_peer_free_voidp(void *d) {
-  xbt_peer_free( (xbt_peer_t) *(void**)d );
+void xbt_peer_free_voidp(void *d)
+{
+  xbt_peer_free((xbt_peer_t) * (void **) d);
 }