Revision: 5849 http://geany.svn.sourceforge.net/geany/?rev=5849&view=rev Author: colombanw Date: 2011-06-13 23:03:50 +0000 (Mon, 13 Jun 2011)
Log Message: ----------- Remove checks for the GSlice allocator, use it unconditionally
Modified Paths: -------------- trunk/ChangeLog trunk/src/pluginutils.c trunk/tagmanager/tm_file_entry.c trunk/tagmanager/tm_symbol.c trunk/tagmanager/tm_tag.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2011-06-13 23:03:19 UTC (rev 5848) +++ trunk/ChangeLog 2011-06-13 23:03:50 UTC (rev 5849) @@ -18,6 +18,9 @@ Fix Printing preferences page alignment. * src/notebook.c: Remove pre-GTK 2.10 tab DnD support. + * src/pluginutils.c, tagmanager/tm_file_entry.c, + tagmanager/tm_symbol.c, tagmanager/tm_tag.c: + Unconditionally use GSlice allocator.
2011-06-11 Colomban Wendling <colomban(at)geany(dot)org>
Modified: trunk/src/pluginutils.c =================================================================== --- trunk/src/pluginutils.c 2011-06-13 23:03:19 UTC (rev 5848) +++ trunk/src/pluginutils.c 2011-06-13 23:03:50 UTC (rev 5849) @@ -140,16 +140,6 @@ } PluginSourceData;
-/* use GSlice if available */ -#if GLIB_CHECK_VERSION(2,10,0) -# define PSD_ALLOC() (g_slice_alloc(sizeof(PluginSourceData))) -# define PSD_FREE(psd) (g_slice_free1(sizeof(PluginSourceData), (psd))) -#else -# define PSD_ALLOC() (g_malloc(sizeof(PluginSourceData))) -# define PSD_FREE(psd) (g_free(psd)) -#endif - - /* prepend psd->list_link to psd->plugin->sources */ static void psd_register(PluginSourceData *psd, GSource *source) { @@ -179,7 +169,7 @@ PluginSourceData *psd = data;
psd_unregister(psd); - PSD_FREE(psd); + g_slice_free1(sizeof *psd, psd); }
@@ -196,7 +186,7 @@ static guint plugin_source_add(GeanyPlugin *plugin, GSource *source, GSourceFunc func, gpointer data) { guint id; - PluginSourceData *psd = PSD_ALLOC(); + PluginSourceData *psd = g_slice_alloc(sizeof *psd);
psd->plugin = plugin->priv; psd->function = func;
Modified: trunk/tagmanager/tm_file_entry.c =================================================================== --- trunk/tagmanager/tm_file_entry.c 2011-06-13 23:03:19 UTC (rev 5848) +++ trunk/tagmanager/tm_file_entry.c 2011-06-13 23:03:50 UTC (rev 5849) @@ -28,27 +28,10 @@ #include "tm_file_entry.h"
-#if GLIB_CHECK_VERSION (2, 10, 0) -/* Use GSlices if present */ - #define FILE_NEW(T) ((T) = g_slice_new0(TMFileEntry)) #define FILE_FREE(T) g_slice_free(TMFileEntry, (T))
-#else /* GLib < 2.10 */
-static GMemChunk *file_mem_chunk = NULL; - -#define FILE_NEW(T) {\ - if (!file_mem_chunk) \ - file_mem_chunk = g_mem_chunk_new("TMFileEntry MemChunk", sizeof(TMFileEntry), 1024 \ - , G_ALLOC_AND_FREE); \ - (T) = g_chunk_new0(TMFileEntry, file_mem_chunk);} - -#define FILE_FREE(T) g_mem_chunk_free(file_mem_chunk, (T)) - -#endif /* GLib version check */ - - void tm_file_entry_print(TMFileEntry *entry, gpointer __unused__ user_data , guint level) {
Modified: trunk/tagmanager/tm_symbol.c =================================================================== --- trunk/tagmanager/tm_symbol.c 2011-06-13 23:03:19 UTC (rev 5848) +++ trunk/tagmanager/tm_symbol.c 2011-06-13 23:03:50 UTC (rev 5849) @@ -13,27 +13,10 @@ #include "tm_symbol.h"
-#if GLIB_CHECK_VERSION (2, 10, 0) -/* Use GSlices if present */ - #define SYM_NEW(T) ((T) = g_slice_new0(TMSymbol)) #define SYM_FREE(T) g_slice_free(TMSymbol, (T))
-#else /* GLib < 2.10 */
-static GMemChunk *sym_mem_chunk = NULL; - -#define SYM_NEW(T) {\ - if (!sym_mem_chunk) \ - sym_mem_chunk = g_mem_chunk_new("TMSymbol MemChunk", sizeof(TMSymbol), 1024 \ - , G_ALLOC_AND_FREE); \ - (T) = g_chunk_new0(TMSymbol, sym_mem_chunk);} - -#define SYM_FREE(T) g_mem_chunk_free(sym_mem_chunk, (T)) - -#endif /* GLib version check */ - - void tm_symbol_print(TMSymbol *sym, guint level) { guint i;
Modified: trunk/tagmanager/tm_tag.c =================================================================== --- trunk/tagmanager/tm_tag.c 2011-06-13 23:03:19 UTC (rev 5848) +++ trunk/tagmanager/tm_tag.c 2011-06-13 23:03:50 UTC (rev 5849) @@ -19,27 +19,10 @@ #include "tm_tag.h"
-#if GLIB_CHECK_VERSION (2, 10, 0) -/* Use GSlices if present */ - #define TAG_NEW(T) ((T) = g_slice_new0(TMTag)) #define TAG_FREE(T) g_slice_free(TMTag, (T))
-#else /* GLib < 2.10 */
-static GMemChunk *s_tag_mem_chunk = NULL; - -#define TAG_NEW(T) {\ - if (!s_tag_mem_chunk) \ - s_tag_mem_chunk = g_mem_chunk_new("TMTag memChunk", sizeof(TMTag), 1024 \ - , G_ALLOC_AND_FREE); \ - (T) = g_chunk_new0(TMTag, s_tag_mem_chunk);} - -#define TAG_FREE(T) g_mem_chunk_free(s_tag_mem_chunk, (T)) - -#endif /* GLib version check */ - - /* Note: To preserve binary compatibility, it is very important that you only *append* to this list ! */ enum
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.