[WinForms] Fix #18506 ActiveTracker, do not propagate message to control when it...
[mono-project.git] / mono / metadata / mempool-internals.h
blobc16e83438e4435c502a6048d71feca61e8f341ac
1 /**
2 * \file
3 */
5 #ifndef _MONO_MEMPOOL_INTERNALS_H_
6 #define _MONO_MEMPOOL_INTERNALS_H_
8 #include <glib.h>
10 #include "mono/utils/mono-compiler.h"
11 #include "mono/metadata/mempool.h"
13 static inline GList*
14 g_list_prepend_mempool (MonoMemPool *mp, GList *list, gpointer data)
16 GList *new_list;
18 new_list = (GList *) mono_mempool_alloc (mp, sizeof (GList));
19 new_list->data = data;
20 new_list->prev = list ? list->prev : NULL;
21 new_list->next = list;
23 if (new_list->prev)
24 new_list->prev->next = new_list;
25 if (list)
26 list->prev = new_list;
28 return new_list;
31 static inline GSList*
32 g_slist_prepend_mempool (MonoMemPool *mp, GSList *list, gpointer data)
34 GSList *new_list;
36 new_list = (GSList *) mono_mempool_alloc (mp, sizeof (GSList));
37 new_list->data = data;
38 new_list->next = list;
40 return new_list;
43 static inline GSList*
44 g_slist_append_mempool (MonoMemPool *mp, GSList *list, gpointer data)
46 GSList *new_list;
47 GSList *last;
49 new_list = (GSList *) mono_mempool_alloc (mp, sizeof (GSList));
50 new_list->data = data;
51 new_list->next = NULL;
53 if (list) {
54 last = list;
55 while (last->next)
56 last = last->next;
57 last->next = new_list;
59 return list;
60 } else
61 return new_list;
64 static inline GList*
65 g_list_append_mempool (MonoMemPool *mp, GList *list, gpointer data)
67 GList *new_list;
69 new_list = (GList *) mono_mempool_alloc0 (mp, sizeof (GList));
70 new_list->data = data;
71 new_list->prev = g_list_last (list);
72 if (new_list->prev)
73 new_list->prev->next = new_list;
75 return list ? list : new_list;
78 char*
79 mono_mempool_strdup_vprintf (MonoMemPool *pool, const char *format, va_list args);
81 char*
82 mono_mempool_strdup_printf (MonoMemPool *pool, const char *format, ...) MONO_ATTR_FORMAT_PRINTF(2,3);
84 long
85 mono_mempool_get_bytes_allocated (void);
87 #endif