resource_internal.h
Go to the documentation of this file.
/*
* resource_internal.h
*
* Internal structures for the resource management
*
* Copyright (C) 2013-2014 Sylvain Munaut
*
* This program 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.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RESOURCE_INTERNAL_H__
#define __RESOURCE_INTERNAL_H__
/*! \addtogroup resource
* @{
*/
/*! \file resource_internal.h
* \brief Internal header for the resource management
*/
#include "llist.h"
/*! \brief Internal structure describing a packed resource */
struct resource_pack
{
const char *name; /*!< \brief Name of the resource */
const void *data; /*!< \brief Data (with added final \0) */
unsigned int len; /*!< \brief Original length (in bytes) of data */
};
struct resource_cache
{
struct llist_head head; /*< \brief Linked list head for cache */
const char *name; /*< \brief Name of the resource */
const void *data; /*< \brief Data pointer given to user */
unsigned int len; /*< \brief riginal length (in bytes) of data */
int refcnt; /*< \brief Reference counter */
int flags; /*< \brief Flags */
#define RES_FLAG_MALLOCED (1 << 0)
char extra[0]; /*< \brief Extra data for whatever ... */
};
/*! @} */
#endif /* __RESOURCE_INTERNAL_H__ */
llist.h
Simple double-linked list.
llist_head
Definition: llist.h:38
resource_cache
Definition: resource_internal.h:44
resource_cache::len
unsigned int len
Definition: resource_internal.h:49
resource_cache::data
const void * data
Definition: resource_internal.h:48
resource_cache::refcnt
int refcnt
Definition: resource_internal.h:51
resource_cache::head
struct llist_head head
Definition: resource_internal.h:45
resource_cache::flags
int flags
Definition: resource_internal.h:52
resource_cache::name
const char * name
Definition: resource_internal.h:47
resource_cache::extra
char extra[0]
Definition: resource_internal.h:56
resource_pack
Internal structure describing a packed resource.
Definition: resource_internal.h:37
resource_pack::data
const void * data
Data (with added final \0)
Definition: resource_internal.h:39
resource_pack::name
const char * name
Name of the resource.
Definition: resource_internal.h:38
resource_pack::len
unsigned int len
Original length (in bytes) of data.
Definition: resource_internal.h:40