]> git.sur5r.net Git - cc65/commitdiff
Add cc65_idlist.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 15 Aug 2011 17:42:43 +0000 (17:42 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 15 Aug 2011 17:42:43 +0000 (17:42 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5175 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/dbginfo/dbginfo.c
src/dbginfo/dbginfo.h

index 14f0e29e469bc9f3536636105e1ed5f3d900d7ce..a899543875d9e4d13b3f8eff6975e3a64f6281c1 100644 (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                                 */
 /*****************************************************************************/
@@ -1023,7 +1043,7 @@ static cc65_sourceinfo* new_cc65_sourceinfo (unsigned Count)
 {
     cc65_sourceinfo* S = xmalloc (sizeof (*S) - sizeof (S->data[0]) +
                                   Count * sizeof (S->data[0]));
-    S->count = Count;
+    S->count = Count;        
     return S;
 }
 
index 5867c0a6a157c8a7dbc822f4b5529d49afdc5779..030a6602f2e628fc92c90fc7756ca8ebc9069dc0 100644 (file)
@@ -61,6 +61,13 @@ typedef unsigned cc65_size;             /* Used to store (65xx) sizes */
 /* A value that is used to mark invalid ids */
 #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 */
+};
+
 
 
 /*****************************************************************************/