[Nautilus-list] Small optimization



Hello,

I have started playing with Nautilus last night, hoping to maybe
contribute something useful to optimize it a bit, and I came across
get_metafile() in nautilus-directory-metafile.c, which seems to be doing
a useless alloc/free and CORBA_exception_init/free in the case where you
already have the CORBA interface set up.

  This gets called for each file when opening a directory, and the CORBA
interface is already up in that case, so I think it should be fixed.

  Can I commit this patch?

  BTW, what is the reason for having a hard limit on the number of files
that can be displayed in a Nautilus directory view
(NAUTILUS_DIRECTORY_FILE_LIST_HARD_LIMIT)?

-- 
Ettore
Index: libnautilus-private/nautilus-directory-metafile.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-directory-metafile.c,v
retrieving revision 1.32
diff -u -u -r1.32 nautilus-directory-metafile.c
--- libnautilus-private/nautilus-directory-metafile.c	2001/05/04 03:14:03	1.32
+++ libnautilus-private/nautilus-directory-metafile.c	2001/06/29 19:56:23
@@ -73,21 +73,21 @@
 static Nautilus_Metafile
 get_metafile (NautilusDirectory *directory)
 {
-	char *uri;
-	CORBA_Environment ev;
+	if (directory->details->metafile_corba_object == CORBA_OBJECT_NIL) {
+		char *uri;
+		CORBA_Environment ev;
 
-	uri = nautilus_directory_get_uri (directory);
+		uri = nautilus_directory_get_uri (directory);
 	
-	CORBA_exception_init (&ev);
+		CORBA_exception_init (&ev);
 
-	if (directory->details->metafile_corba_object == CORBA_OBJECT_NIL) {
 		directory->details->metafile_corba_object = Nautilus_MetafileFactory_open (get_factory (), uri, &ev);
-	}
-	
-	/* FIXME bugzilla.eazel.com 6664: examine ev for errors */
-	CORBA_exception_free (&ev);
+
+		/* FIXME bugzilla.eazel.com 6664: examine ev for errors */
+		CORBA_exception_free (&ev);
 	
-	g_free (uri);
+		g_free (uri);
+	}
 
 	return bonobo_object_dup_ref (directory->details->metafile_corba_object, NULL);	
 }


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