[maemo-commits] [maemo-commits] r14918 - in projects/haf/trunk/maemo-launcher: . launcher

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Dec 7 20:36:08 EET 2007
Author: guillem
Date: 2007-12-07 20:36:05 +0200 (Fri, 07 Dec 2007)
New Revision: 14918

Modified:
   projects/haf/trunk/maemo-launcher/ChangeLog
   projects/haf/trunk/maemo-launcher/launcher/launcher.c
Log:
Refactor child destruction into child_destroy()


Modified: projects/haf/trunk/maemo-launcher/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-launcher/ChangeLog	2007-12-07 17:32:05 UTC (rev 14917)
+++ projects/haf/trunk/maemo-launcher/ChangeLog	2007-12-07 18:36:05 UTC (rev 14918)
@@ -1,5 +1,11 @@
 2007-12-07  Guillem Jover  <guillem.jover at nokia.com>
 
+	* launcher/launcher.c (child_destroy): New function.
+	(release_childs): Use child_destroy instead of inline destroy.
+	(release_child_slot): Likewise.
+
+2007-12-07  Guillem Jover  <guillem.jover at nokia.com>
+
 	* client/Makefile.am (PIE): Remove variable.
 	(maemo_client_CPPFLAGS): Add $(PIC).
 	(maemo_client_LDFLAGS): Rename $(PIE) to $(PIC). Add '-shared'.

Modified: projects/haf/trunk/maemo-launcher/launcher/launcher.c
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/launcher.c	2007-12-07 17:32:05 UTC (rev 14917)
+++ projects/haf/trunk/maemo-launcher/launcher/launcher.c	2007-12-07 18:36:05 UTC (rev 14918)
@@ -357,6 +357,16 @@
   exit(0);
 }
 
+static void
+child_destroy(child_t *child)
+{
+  close(child->sock);
+  child->sock = 0;
+  free(child->name);
+  child->name = NULL;
+  child->pid = 0;
+}
+
 static kindergarten_t *
 alloc_childs(int n)
 {
@@ -408,10 +418,7 @@
   child_t *list = childs->list;
 
   for (i = 0; i < childs->used; i++)
-  {
-    close(list[i].sock);
-    free(list[i].name);
-  }
+    child_destroy(&list[i]);
 
   childs->used = 0;
   childs->n = 0;
@@ -499,13 +506,7 @@
 
     invoked_send_exit(child->sock, status);
 
-    close(child->sock);
-    free(child->name);
-
-    child->name = NULL;
-    child->sock = 0;
-    child->pid = 0;
-
+    child_destroy(child);
     childs->used--;
   }
   else


More information about the maemo-commits mailing list