* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
/*
# define LEAVE_MEM_CHUNK_ROUTINE() (mem_chunk_recursion = MEM_CHUNK_ROUTINE_COUNT () - 1)
/* --- old memchunk prototypes --- */
-void old_mem_chunks_init (void);
GMemChunk* old_mem_chunk_new (const gchar *name,
gint atom_size,
gulong area_size,
/* here we can't use StaticMutexes, as they depend upon a working
* g_malloc, the same holds true for StaticPrivate
*/
-static GMutex *mem_chunks_lock = NULL;
+static GMutex mem_chunks_lock;
static GMemChunk *mem_chunks = NULL;
-void
-old_mem_chunks_init (void)
-{
- mem_chunks_lock = g_mutex_new ();
-}
-
GMemChunk*
old_mem_chunk_new (const gchar *name,
gint atom_size,
rarea_size = old_mem_chunk_compute_size (rarea_size, atom_size + sizeof (GMemArea) - MEM_AREA_SIZE);
mem_chunk->area_size = rarea_size - (sizeof (GMemArea) - MEM_AREA_SIZE);
- g_mutex_lock (mem_chunks_lock);
+ g_mutex_lock (&mem_chunks_lock);
mem_chunk->next = mem_chunks;
mem_chunk->prev = NULL;
if (mem_chunks)
mem_chunks->prev = mem_chunk;
mem_chunks = mem_chunk;
- g_mutex_unlock (mem_chunks_lock);
+ g_mutex_unlock (&mem_chunks_lock);
LEAVE_MEM_CHUNK_ROUTINE ();
g_free (temp_area);
}
- g_mutex_lock (mem_chunks_lock);
+ g_mutex_lock (&mem_chunks_lock);
if (mem_chunk->next)
mem_chunk->next->prev = mem_chunk->prev;
if (mem_chunk->prev)
if (mem_chunk == mem_chunks)
mem_chunks = mem_chunks->next;
- g_mutex_unlock (mem_chunks_lock);
+ g_mutex_unlock (&mem_chunks_lock);
if (mem_chunk->type == G_ALLOC_AND_FREE)
g_tree_destroy (mem_chunk->mem_tree);
* (ie marked to be destroyed).
* We check to see if all of the segments on the free list that
* reference this area have been removed. This occurs when
- * the ammount of free memory is less than the allocatable size.
+ * the amount of free memory is less than the allocatable size.
* If the chunk should be freed, then we place it in the "free_mem_area".
* This is so we make sure not to free the mem area here and then
* allocate it again a few lines down.
gint count;
count = 0;
- g_mutex_lock (mem_chunks_lock);
+ g_mutex_lock (&mem_chunks_lock);
mem_chunk = mem_chunks;
while (mem_chunk)
{
count += 1;
mem_chunk = mem_chunk->next;
}
- g_mutex_unlock (mem_chunks_lock);
+ g_mutex_unlock (&mem_chunks_lock);
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, "%d mem chunks", count);
- g_mutex_lock (mem_chunks_lock);
+ g_mutex_lock (&mem_chunks_lock);
mem_chunk = mem_chunks;
- g_mutex_unlock (mem_chunks_lock);
+ g_mutex_unlock (&mem_chunks_lock);
while (mem_chunk)
{