From ef6c95d18baeb63134e6c03054fd62d0a6ae0302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Mon, 4 Jun 2007 16:51:53 +0000 Subject: [PATCH] Replace malloc() by g_malloc(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1600 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 12 +++++------- tagmanager/sort.c | 7 ++++--- tagmanager/tm_workspace.c | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f39af7e4f..ce5362b59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2007-06-04 Enrico Tröger + * src/main.c: Add rpl_malloc() for better compatibility with non-GNU + systems (thanks to Harri Koskinen for reporting). * po/POTFILES.in: Add navqueue.c. * po/intl_stats.sh: Add revision time to the output. * src/callbacks.c, src/callbacks.h: @@ -8,14 +10,10 @@ Re-maximize the main window on startup when closed in maximized state (closes #1730369). * src/geany.h, src/keyfile.c, src/main.c: - Improved code to avoid hiding the messages window + Improve code to avoid hiding the messages window (caused by last commit). - - -2007-06-04 Enrico Tröger - - * src/main.c: Add rpl_malloc() for better compatibility with non-GNU - systems (thanks to Harri Koskinen for reporting). + * tagmanager/sort.c, tagmanager/tm_workspace.c: + Replace malloc() by g_malloc(). 2007-06-03 Enrico Tröger diff --git a/tagmanager/sort.c b/tagmanager/sort.c index cf29b3f92..7435159e1 100644 --- a/tagmanager/sort.c +++ b/tagmanager/sort.c @@ -18,6 +18,7 @@ #endif #include #include +#include #include "entry.h" #include "main.h" @@ -63,7 +64,7 @@ extern void externalSortTags (const boolean toStdout) PE_CONST char *const sortOrder2 = "LC_ALL=C"; const size_t length = 4 + strlen (sortOrder1) + strlen (sortOrder2) + strlen (sortCommand) + (2 * strlen (tagFileName ())); - char *const cmd = (char *) malloc (length + 1); + char *const cmd = (char *) g_malloc (length + 1); int ret = -1; if (cmd != NULL) @@ -164,7 +165,7 @@ extern void internalSortTags (const boolean toStdout) */ size_t numTags = TagFile.numTags.added + TagFile.numTags.prev; const size_t tableSize = numTags * sizeof (char *); - char **const table = (char **) malloc (tableSize); /* line pointers */ + char **const table = (char **) g_malloc (tableSize); /* line pointers */ DebugStatement ( size_t mallocSize = tableSize; ) /* cumulative total */ if (table == NULL) @@ -190,7 +191,7 @@ extern void internalSortTags (const boolean toStdout) { const size_t stringSize = strlen (line) + 1; - table [i] = (char *) malloc (stringSize); + table [i] = (char *) g_malloc (stringSize); if (table [i] == NULL) failedSort (fp, "out of memory"); DebugStatement ( mallocSize += stringSize; ) diff --git a/tagmanager/tm_workspace.c b/tagmanager/tm_workspace.c index 515f81587..b69a6f6ff 100644 --- a/tagmanager/tm_workspace.c +++ b/tagmanager/tm_workspace.c @@ -114,7 +114,7 @@ gboolean tm_workspace_add_object(TMWorkObject *work_object) return TRUE; } -gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean free) +gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean do_free) { guint i; if ((NULL == theWorkspace) || (NULL == theWorkspace->work_objects) @@ -124,7 +124,7 @@ gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean free) { if (theWorkspace->work_objects->pdata[i] == w) { - if (free) + if (do_free) tm_work_object_free(w); g_ptr_array_remove_index_fast(theWorkspace->work_objects, i); tm_workspace_update(TM_WORK_OBJECT(theWorkspace), TRUE, FALSE, FALSE); @@ -284,7 +284,7 @@ gboolean tm_workspace_create_global_tags(const char *pre_process, const char **i for(idx_inc = 0; idx_inc < includes_count; idx_inc++) { int dirty_len = strlen(includes[idx_inc]); - char *clean_path = malloc(dirty_len - 1); + char *clean_path = g_malloc(dirty_len - 1); strncpy(clean_path, includes[idx_inc] + 1, dirty_len - 1); clean_path[dirty_len - 2] = 0;