/* Chrysalide - Outil d'analyse de fichiers binaires * umemslice-int.h - prototypes internes pour les allocations en série d'un même type d'objets * * Copyright (C) 2023 Cyrille Bagard * * This file is part of Chrysalide. * * Chrysalide is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Chrysalide is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Chrysalide. If not, see . */ #ifndef _GLIBEXT_UMEMSLICE_INT_H #define _GLIBEXT_UMEMSLICE_INT_H #include #include "umemslice.h" /* Informations portant sur un bloc */ typedef struct _slice_slab_info_t { void *data_max; /* Zone de débordement */ umem_slice_iter_t iter; /* Données pour l'utilisateur */ } slice_slab_info_t; #define SLICE_INFO_SIZE (sizeof(void *) + sizeof(umem_slice_iter_t)) /* Allocateur s'appuyant sur des séries d'objets de même type (instance) */ struct _GUMemSlice { GObject parent; /* A laisser en premier */ size_t obj_size; /* Taille des objects */ slice_slab_info_t *slabs; /* Ensembles complets */ slice_slab_info_t *last; /* Accès à l'ultime tranche */ }; /* Allocateur s'appuyant sur des séries d'objets de même type (classe) */ struct _GUMemSliceClass { GObjectClass parent; /* A laisser en premier */ }; /* Met en place un allocateur de zones identiques. */ bool g_umem_slice_create(GUMemSlice *, size_t); #endif /* _GLIBEXT_UMEMSLICE_INT_H */