SF.net SVN: geany: [2033] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Nov 7 17:57:38 UTC 2007


Revision: 2033
          http://geany.svn.sourceforge.net/geany/?rev=2033&view=rev
Author:   eht16
Date:     2007-11-07 09:57:38 -0800 (Wed, 07 Nov 2007)

Log Message:
-----------
Don't create tagmanager status file, seems to be unnecessary (needs testing).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tagmanager/tm_work_object.c
    trunk/tagmanager/tm_workspace.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-11-07 17:33:42 UTC (rev 2032)
+++ trunk/ChangeLog	2007-11-07 17:57:38 UTC (rev 2033)
@@ -3,6 +3,9 @@
  * src/vte.c: Apply patch from Simone Denei to add a "Restart" item to
               the VTE popup menu in case running application hangs.
  * src/utils.c: Fix bug when creating configuration directory on Unix.
+ * tagmanager/tm_work_object.c, tagmanager/tm_workspace.c:
+   Don't create tagmanager status file, seems to be unnecessary
+   (needs testing).
 
 
 2007-11-06  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/tagmanager/tm_work_object.c
===================================================================
--- trunk/tagmanager/tm_work_object.c	2007-11-07 17:33:42 UTC (rev 2032)
+++ trunk/tagmanager/tm_work_object.c	2007-11-07 17:57:38 UTC (rev 2033)
@@ -91,37 +91,45 @@
 	struct stat s;
 	int status;
 
-	if (0 != (status = g_stat(file_name, &s)))
+	if (file_name != NULL)
 	{
-		if (create)
+		if (0 != (status = g_stat(file_name, &s)))
 		{
-			FILE *f;
-			if (NULL == (f = g_fopen(file_name, "a+")))
+			if (create)
 			{
-				g_warning("Unable to create file %s", file_name);
-				return FALSE;
+				FILE *f;
+				if (NULL == (f = g_fopen(file_name, "a+")))
+				{
+					g_warning("Unable to create file %s", file_name);
+					return FALSE;
+				}
+				fclose(f);
+				status = g_stat(file_name, &s);
 			}
-			fclose(f);
-			status = g_stat(file_name, &s);
 		}
+		if (0 != status)
+		{
+			/* g_warning("Unable to stat %s", file_name);*/
+			return FALSE;
+		}
+		if (!S_ISREG(s.st_mode))
+		{
+			g_warning("%s: Not a regular file", file_name);
+			return FALSE;
+		}
+		work_object->file_name = tm_get_real_path(file_name);
+		work_object->short_name = strrchr(work_object->file_name, '/');
+		if (work_object->short_name)
+			++ work_object->short_name;
+		else
+			work_object->short_name = work_object->file_name;
 	}
-	if (0 != status)
+	else
 	{
-		/* g_warning("Unable to stat %s", file_name);*/
-		return FALSE;
+		work_object->file_name = NULL;
+		work_object->short_name = NULL;
 	}
-	if (!S_ISREG(s.st_mode))
-	{
-		g_warning("%s: Not a regular file", file_name);
-		return FALSE;
-	}
 	work_object->type = type;
-	work_object->file_name = tm_get_real_path(file_name);
-	work_object->short_name = strrchr(work_object->file_name, '/');
-	if (work_object->short_name)
-		++ work_object->short_name;
-	else
-		work_object->short_name = work_object->file_name;
 	work_object->parent = NULL;
 	work_object->analyze_time = 0;
 	work_object->tags_array = NULL;

Modified: trunk/tagmanager/tm_workspace.c
===================================================================
--- trunk/tagmanager/tm_workspace.c	2007-11-07 17:33:42 UTC (rev 2032)
+++ trunk/tagmanager/tm_workspace.c	2007-11-07 17:57:38 UTC (rev 2033)
@@ -31,24 +31,18 @@
 
 static gboolean tm_create_workspace(const gchar *config_dir)
 {
-	/// TODO check whether the created file is really necessary at all
-	gchar *file_name = g_strdup_printf("%s%ctagmanager_%ld.%d",
-		config_dir, G_DIR_SEPARATOR, time(NULL), getpid());
-
 	workspace_class_id = tm_work_object_register(tm_workspace_free, tm_workspace_update
 		  , tm_workspace_find_object);
 	theWorkspace = g_new(TMWorkspace, 1);
 	if (FALSE == tm_work_object_init(TM_WORK_OBJECT(theWorkspace),
-		  workspace_class_id, file_name, TRUE))
+		  workspace_class_id, NULL, TRUE))
 	{
-		g_free(file_name);
 		g_free(theWorkspace);
 		theWorkspace = NULL;
 		g_warning("Failed to initialize workspace");
 		return FALSE;
 	}
 
-	g_free(file_name);
 	theWorkspace->global_tags = NULL;
 	theWorkspace->work_objects = NULL;
 	return TRUE;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list