/* common */
+#include "check.h"
#include "gentype.h"
#include "strbuf.h"
unsigned SizeBytes;
/* Remember the current position */
- char* A = SB_GetBuf (Type) + SB_GetLen (Type);
+ unsigned Pos = SB_GetLen (Type);
/* Add a dummy array token */
SB_AppendChar (Type, GT_TYPE_ARRAY);
} while (ArraySize);
/* Write the correct array token */
- *A = GT_ARRAY (SizeBytes);
+ SB_GetBuf (Type)[Pos] = GT_ARRAY (SizeBytes);
}
-unsigned GT_GetArraySize (StrBuf* Type)
-/* Retrieve the size of an array stored in Type at the current index position.
- * The index position will get moved past the array size.
+unsigned GT_GetElementCount (StrBuf* Type)
+/* Retrieve the element count of an array stored in Type at the current index
+ * position. Note: Index must point to the array token itself, since the size
+ * of the element count is encoded there. The index position will get moved
+ * past the array.
*/
{
/* Get the number of bytes for the element count */
/* Return the contents of String */
return SB_GetConstBuf (String);
}
-
-
-
-
-
-