Kaydet (Commit) ef6c95d1 authored tarafından Enrico Tröger's avatar Enrico Tröger

Replace malloc() by g_malloc().


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@1600 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 16772323
2007-06-04 Enrico Tröger <enrico.troeger@uvena.de> 2007-06-04 Enrico Tröger <enrico.troeger@uvena.de>
* 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/POTFILES.in: Add navqueue.c.
* po/intl_stats.sh: Add revision time to the output. * po/intl_stats.sh: Add revision time to the output.
* src/callbacks.c, src/callbacks.h: * src/callbacks.c, src/callbacks.h:
...@@ -8,14 +10,10 @@ ...@@ -8,14 +10,10 @@
Re-maximize the main window on startup when closed in maximized state Re-maximize the main window on startup when closed in maximized state
(closes #1730369). (closes #1730369).
* src/geany.h, src/keyfile.c, src/main.c: * 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). (caused by last commit).
* tagmanager/sort.c, tagmanager/tm_workspace.c:
Replace malloc() by g_malloc().
2007-06-04 Enrico Tröger <enrico.troeger@uvena.de>
* src/main.c: Add rpl_malloc() for better compatibility with non-GNU
systems (thanks to Harri Koskinen for reporting).
2007-06-03 Enrico Tröger <enrico.troeger@uvena.de> 2007-06-03 Enrico Tröger <enrico.troeger@uvena.de>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#endif #endif
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <glib.h>
#include "entry.h" #include "entry.h"
#include "main.h" #include "main.h"
...@@ -63,7 +64,7 @@ extern void externalSortTags (const boolean toStdout) ...@@ -63,7 +64,7 @@ extern void externalSortTags (const boolean toStdout)
PE_CONST char *const sortOrder2 = "LC_ALL=C"; PE_CONST char *const sortOrder2 = "LC_ALL=C";
const size_t length = 4 + strlen (sortOrder1) + strlen (sortOrder2) + const size_t length = 4 + strlen (sortOrder1) + strlen (sortOrder2) +
strlen (sortCommand) + (2 * strlen (tagFileName ())); strlen (sortCommand) + (2 * strlen (tagFileName ()));
char *const cmd = (char *) malloc (length + 1); char *const cmd = (char *) g_malloc (length + 1);
int ret = -1; int ret = -1;
if (cmd != NULL) if (cmd != NULL)
...@@ -164,7 +165,7 @@ extern void internalSortTags (const boolean toStdout) ...@@ -164,7 +165,7 @@ extern void internalSortTags (const boolean toStdout)
*/ */
size_t numTags = TagFile.numTags.added + TagFile.numTags.prev; size_t numTags = TagFile.numTags.added + TagFile.numTags.prev;
const size_t tableSize = numTags * sizeof (char *); 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 */ DebugStatement ( size_t mallocSize = tableSize; ) /* cumulative total */
if (table == NULL) if (table == NULL)
...@@ -190,7 +191,7 @@ extern void internalSortTags (const boolean toStdout) ...@@ -190,7 +191,7 @@ extern void internalSortTags (const boolean toStdout)
{ {
const size_t stringSize = strlen (line) + 1; const size_t stringSize = strlen (line) + 1;
table [i] = (char *) malloc (stringSize); table [i] = (char *) g_malloc (stringSize);
if (table [i] == NULL) if (table [i] == NULL)
failedSort (fp, "out of memory"); failedSort (fp, "out of memory");
DebugStatement ( mallocSize += stringSize; ) DebugStatement ( mallocSize += stringSize; )
......
...@@ -114,7 +114,7 @@ gboolean tm_workspace_add_object(TMWorkObject *work_object) ...@@ -114,7 +114,7 @@ gboolean tm_workspace_add_object(TMWorkObject *work_object)
return TRUE; return TRUE;
} }
gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean free) gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean do_free)
{ {
guint i; guint i;
if ((NULL == theWorkspace) || (NULL == theWorkspace->work_objects) if ((NULL == theWorkspace) || (NULL == theWorkspace->work_objects)
...@@ -124,7 +124,7 @@ gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean free) ...@@ -124,7 +124,7 @@ gboolean tm_workspace_remove_object(TMWorkObject *w, gboolean free)
{ {
if (theWorkspace->work_objects->pdata[i] == w) if (theWorkspace->work_objects->pdata[i] == w)
{ {
if (free) if (do_free)
tm_work_object_free(w); tm_work_object_free(w);
g_ptr_array_remove_index_fast(theWorkspace->work_objects, i); g_ptr_array_remove_index_fast(theWorkspace->work_objects, i);
tm_workspace_update(TM_WORK_OBJECT(theWorkspace), TRUE, FALSE, FALSE); 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 ...@@ -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++) for(idx_inc = 0; idx_inc < includes_count; idx_inc++)
{ {
int dirty_len = strlen(includes[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); strncpy(clean_path, includes[idx_inc] + 1, dirty_len - 1);
clean_path[dirty_len - 2] = 0; clean_path[dirty_len - 2] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment