resource_internal.h
Go to the documentation of this file.
/*
* resource_internal.h
*
* Internal structures for the resource management
*
* Copyright (C) 2013-2021 Sylvain Munaut
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
/*! \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 ... */
};
/*! @} */
llist.h
Simple double-linked list.
llist_head
Definition llist.h:25
resource_cache
Definition resource_internal.h:31
resource_cache::len
unsigned int len
Definition resource_internal.h:36
resource_cache::data
const void * data
Definition resource_internal.h:35
resource_cache::refcnt
int refcnt
Definition resource_internal.h:38
resource_cache::head
struct llist_head head
Definition resource_internal.h:32
resource_cache::flags
int flags
Definition resource_internal.h:39
resource_cache::name
const char * name
Definition resource_internal.h:34
resource_cache::extra
char extra[0]
Definition resource_internal.h:43
resource_pack
Internal structure describing a packed resource.
Definition resource_internal.h:24
resource_pack::data
const void * data
Data (with added final \0)
Definition resource_internal.h:26
resource_pack::name
const char * name
Name of the resource.
Definition resource_internal.h:25
resource_pack::len
unsigned int len
Original length (in bytes) of data.
Definition resource_internal.h:27