Blame lib/boxed.c

Packit d37888
/* Copyright (C) 2011 Red Hat
Packit d37888
   This file is part of LibGTop 1.0.
Packit d37888
Packit d37888
   Contributed by Jasper St. Pierre <jstpierre@mecheye.net>, November 2011
Packit d37888
Packit d37888
   LibGTop is free software; you can redistribute it and/or modify it
Packit d37888
   under the terms of the GNU General Public License as published by
Packit d37888
   the Free Software Foundation; either version 2 of the License,
Packit d37888
   or (at your option) any later version.
Packit d37888
Packit d37888
   LibGTop is distributed in the hope that it will be useful, but WITHOUT
Packit d37888
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
Packit d37888
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit d37888
   for more details.
Packit d37888
Packit d37888
   You should have received a copy of the GNU General Public License
Packit d37888
   along with LibGTop; see the file COPYING. If not, write to the
Packit d37888
   Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit d37888
   Boston, MA 02111-1307, USA.
Packit d37888
*/
Packit d37888
Packit d37888
#include <glibtop.h>
Packit d37888
#include <glibtop/mountlist.h>
Packit d37888
#include <glibtop/procmap.h>
Packit d37888
#include <glibtop/procopenfiles.h>
Packit d37888
Packit d37888
#define DEFINE_BOXED(type)                              \
Packit d37888
    static type *                                       \
Packit d37888
    type##_copy (type *p)                               \
Packit d37888
    {                                                   \
Packit d37888
        type *n = g_new (type, 1);                      \
Packit d37888
        memcpy (n, p, sizeof (type));                   \
Packit d37888
        return n;                                       \
Packit d37888
    }                                                   \
Packit d37888
                                                        \
Packit d37888
    G_DEFINE_BOXED_TYPE (type,                          \
Packit d37888
                         type,                          \
Packit d37888
                         type##_copy,                   \
Packit d37888
                         g_free)
Packit d37888
Packit d37888
DEFINE_BOXED (glibtop);
Packit d37888
DEFINE_BOXED (glibtop_map_entry);
Packit d37888
DEFINE_BOXED (glibtop_proc_map);
Packit d37888
DEFINE_BOXED (glibtop_open_files_entry);
Packit d37888
DEFINE_BOXED (glibtop_proc_open_files);
Packit d37888
DEFINE_BOXED (glibtop_mountentry);
Packit d37888
DEFINE_BOXED (glibtop_mountlist);