oaf fix.



hi all,

here is a small oaf fix for michael :)

To be applied soon :)

? oaf_patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/oaf/ChangeLog,v
retrieving revision 1.52
diff -u -r1.52 ChangeLog
--- ChangeLog	2000/07/25 15:08:01	1.52
+++ ChangeLog	2000/07/25 22:57:00
@@ -1,3 +1,8 @@
+2000-07-25  Mathieu Lacage  <mathieu@eazel.com>
+
+	* oafd/od-load.c: (OAF_ServerInfo_load): 
+	fix bug 1665 for true after Michael Meeks report.
+
 2000-07-25  Fatih Demir	<kabalak@gmx.net>
 
 	* configure.in: Added "tr" to ALL_LINGUAS.
Index: oafd/od-load.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/od-load.c,v
retrieving revision 1.12
diff -u -r1.12 od-load.c
--- oafd/od-load.c	2000/07/24 19:37:40	1.12
+++ oafd/od-load.c	2000/07/25 22:57:00
@@ -30,7 +30,8 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <string.h>
-#include <parser.h>
+#include <parser.h>      /* gnome-xml */
+#include <xmlmemory.h>   /* gnome-xml */
 
 #define my_slist_prepend(slist, datum) \
 new_item = oaf_alloca(sizeof(GSList)); \
@@ -232,6 +233,7 @@
 			     NULL != curnode; curnode = curnode->next) {
 				OAF_ServerInfo *new_ent;
 				char *ctmp, *iid;
+                                gboolean already_there;
 
 				if (curnode->type != XML_ELEMENT_NODE)
 					continue;
@@ -253,29 +255,42 @@
                                         continue;
                                 }
 
-				new_ent = oaf_alloca (sizeof (OAF_ServerInfo));
-				memset (new_ent, 0, sizeof (OAF_ServerInfo));
-
-				new_ent->iid = CORBA_string_dup (iid);
-				free (iid);
-
-				ctmp = xmlGetProp (curnode, "type");
-				new_ent->server_type =
-					CORBA_string_dup (ctmp);
-				free (ctmp);
-
-				ctmp = xmlGetProp (curnode, "location");
-				new_ent->location_info =
-					CORBA_string_dup (ctmp);
-				new_ent->hostname = CORBA_string_dup (host);
-				new_ent->domain = CORBA_string_dup (domain);
-				new_ent->username =
-					CORBA_string_dup (g_get_user_name ());
-				free (ctmp);
-
-				od_entry_read_attrs (new_ent, curnode);
-
-				my_slist_prepend (entries, new_ent);
+                                /* make sure the component has not been already read. If so,
+                                   do not add this entry to the entries list */
+                                already_there = FALSE;
+                                for (cur = entries; cur != NULL; cur = cur->next) {
+                                        if (strcmp (((OAF_ServerInfo *)cur->data)->iid, iid) == 0) {
+                                                already_there = TRUE;
+                                        }
+                                }
+                                
+                                if (already_there == FALSE) {
+                                        new_ent = oaf_alloca (sizeof (OAF_ServerInfo));
+                                        memset (new_ent, 0, sizeof (OAF_ServerInfo));
+
+                                        new_ent->iid = CORBA_string_dup (iid);
+                                        xmlFree (iid);
+
+                                        ctmp = xmlGetProp (curnode, "type");
+                                        new_ent->server_type =
+                                                CORBA_string_dup (ctmp);
+                                        free (ctmp);
+
+                                        ctmp = xmlGetProp (curnode, "location");
+                                        new_ent->location_info =
+                                                CORBA_string_dup (ctmp);
+                                        new_ent->hostname = CORBA_string_dup (host);
+                                        new_ent->domain = CORBA_string_dup (domain);
+                                        new_ent->username =
+                                                CORBA_string_dup (g_get_user_name ());
+                                        free (ctmp);
+
+                                        od_entry_read_attrs (new_ent, curnode);
+                                        
+                                        my_slist_prepend (entries, new_ent);
+                                } else {
+                                        xmlFree (iid);
+                                }
 
 			}
 


-- 
Mathieu Lacage <mathieu@eazel.com>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]