1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Add cc65_idlist.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5175 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2011-08-15 17:42:43 +00:00
parent 51e918cdfe
commit 8d8c676be2
2 changed files with 28 additions and 1 deletions

View File

@ -980,6 +980,26 @@ static void DBGPRINT(const char* format, ...) {}
/*****************************************************************************/
/* Id lists */
/*****************************************************************************/
static cc65_idlist* new_cc65_idlist (unsigned Count)
/* Allocate and return a new idlist with the given count. The count field in
* the list will already be set on return.
*/
{
/* Allocate memory */
cc65_idlist* L = xmalloc (sizeof (*L) - sizeof (L->ids[0]) +
Count * sizeof (L->ids[0]));
L->count = Count;
return L;
}
/*****************************************************************************/ /*****************************************************************************/
/* File info */ /* File info */
/*****************************************************************************/ /*****************************************************************************/

View File

@ -61,6 +61,13 @@ typedef unsigned cc65_size; /* Used to store (65xx) sizes */
/* A value that is used to mark invalid ids */ /* A value that is used to mark invalid ids */
#define CC65_INV_ID (~0U) #define CC65_INV_ID (~0U)
/* A structure that is used to store a list of ids */
typedef struct cc65_idlist cc65_idlist;
struct cc65_idlist {
unsigned count; /* Number of elements */
unsigned ids[1]; /* List of ids, number is dynamic */
};
/*****************************************************************************/ /*****************************************************************************/