示例#1
0
文件: gmem.c 项目: Jalakas/navit
static gpointer
fallback_calloc (gsize n_blocks,
		 gsize n_block_bytes)
{
  gsize l = n_blocks * n_block_bytes;
  gpointer mem = glib_mem_vtable.vmalloc (l);

  if (mem)
    memset (mem, 0, l);

  return mem;
}
示例#2
0
文件: gmem.c 项目: Jalakas/navit
/* --- functions --- */
gpointer
g_malloc (gsize n_bytes)
{
  if (G_UNLIKELY (!g_mem_initialized))
    g_mem_init_nomessage();
  if (G_LIKELY (n_bytes))
    {
      gpointer mem;

      mem = glib_mem_vtable.vmalloc (n_bytes);
      if (mem)
	return mem;

#if NOT_NEEDED_FOR_NAVIT
      g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes",
               G_STRLOC, n_bytes);
#endif /* NOT_NEEDED_FOR_NAVIT */
    }

  return NULL;
}