/* Returns: a pointer to the newly-allocated copy of the memory, or NULL if @mem is NULL.  */
gpointer g_memdup(gconstpointer mem, guint byte_size)
/* Returns: a pointer to the newly-allocated copy of the memory, or NULL if @mem is NULL.  */
gpointer g_memdup(gconstpointer mem, guint byte_size)
{
  gpointer new_mem;
  if (mem)
    {
      new_mem = g_malloc (byte_size);
      memcpy (new_mem, mem, byte_size);
    }
  else
    new_mem = NULL;
  return new_mem;
}