Blame glib/deprecated/gallocator.c

Packit ae235b
/*
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public
Packit ae235b
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
#include "config.h"
Packit ae235b
Packit ae235b
/* we know we are deprecated here, no need for warnings */
Packit ae235b
#define GLIB_DISABLE_DEPRECATION_WARNINGS
Packit ae235b
Packit ae235b
#include "gallocator.h"
Packit ae235b
Packit ae235b
#include <glib/gmessages.h>
Packit ae235b
#include <glib/gslice.h>
Packit ae235b
Packit ae235b
struct _GMemChunk {
Packit ae235b
  guint alloc_size;           /* the size of an atom */
Packit ae235b
};
Packit ae235b
Packit ae235b
GMemChunk*
Packit ae235b
g_mem_chunk_new (const gchar *name,
Packit ae235b
                 gint         atom_size,
Packit ae235b
                 gsize        area_size,
Packit ae235b
                 gint         type)
Packit ae235b
{
Packit ae235b
  GMemChunk *mem_chunk;
Packit ae235b
Packit ae235b
  g_return_val_if_fail (atom_size > 0, NULL);
Packit ae235b
Packit ae235b
  mem_chunk = g_slice_new (GMemChunk);
Packit ae235b
  mem_chunk->alloc_size = atom_size;
Packit ae235b
Packit ae235b
  return mem_chunk;
Packit ae235b
}
Packit ae235b
Packit ae235b
void
Packit ae235b
g_mem_chunk_destroy (GMemChunk *mem_chunk)
Packit ae235b
{
Packit ae235b
  g_return_if_fail (mem_chunk != NULL);
Packit ae235b
Packit ae235b
  g_slice_free (GMemChunk, mem_chunk);
Packit ae235b
}
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
g_mem_chunk_alloc (GMemChunk *mem_chunk)
Packit ae235b
{
Packit ae235b
  g_return_val_if_fail (mem_chunk != NULL, NULL);
Packit ae235b
Packit ae235b
  return g_slice_alloc (mem_chunk->alloc_size);
Packit ae235b
}
Packit ae235b
Packit ae235b
gpointer
Packit ae235b
g_mem_chunk_alloc0 (GMemChunk *mem_chunk)
Packit ae235b
{
Packit ae235b
  g_return_val_if_fail (mem_chunk != NULL, NULL);
Packit ae235b
Packit ae235b
  return g_slice_alloc0 (mem_chunk->alloc_size);
Packit ae235b
}
Packit ae235b
Packit ae235b
void
Packit ae235b
g_mem_chunk_free (GMemChunk *mem_chunk,
Packit ae235b
                  gpointer   mem)
Packit ae235b
{
Packit ae235b
  g_return_if_fail (mem_chunk != NULL);
Packit ae235b
Packit ae235b
  g_slice_free1 (mem_chunk->alloc_size, mem);
Packit ae235b
}
Packit ae235b
Packit ae235b
GAllocator*
Packit ae235b
g_allocator_new (const gchar *name,
Packit ae235b
                 guint        n_preallocs)
Packit ae235b
{
Packit ae235b
  /* some (broken) GAllocator uses depend on non-NULL allocators */
Packit ae235b
  return (void *) 1;
Packit ae235b
}
Packit ae235b
Packit ae235b
void g_allocator_free           (GAllocator *allocator) { }
Packit ae235b
Packit ae235b
void g_mem_chunk_clean          (GMemChunk *mem_chunk)  { }
Packit ae235b
void g_mem_chunk_reset          (GMemChunk *mem_chunk)  { }
Packit ae235b
void g_mem_chunk_print          (GMemChunk *mem_chunk)  { }
Packit ae235b
void g_mem_chunk_info           (void)                  { }
Packit ae235b
void g_blow_chunks              (void)                  { }
Packit ae235b
Packit ae235b
void g_list_push_allocator      (GAllocator *allocator) { }
Packit ae235b
void g_list_pop_allocator       (void)                  { }
Packit ae235b
Packit ae235b
void g_slist_push_allocator     (GAllocator *allocator) { }
Packit ae235b
void g_slist_pop_allocator      (void)                  { }
Packit ae235b
Packit ae235b
void g_node_push_allocator      (GAllocator *allocator) { }
Packit ae235b
void g_node_pop_allocator       (void)                  { }