+static void FreeCodeRange (CodeRange* R)
+/* Free a CodeRange structure */
+{
+ /* Just free the memory */
+ xfree (R);
+}
+
+
+
static LineInfo* NewLineInfo (void)
/* Create and return a new LineInfo struct with mostly empty fields */
{
+void FreeLineInfo (LineInfo* LI)
+/* Free a LineInfo structure. This function will not handle a non empty
+ * Fragments collection, it can only be used to free incomplete line infos.
+ */
+{
+ unsigned I;
+
+ /* Check, check, ... */
+ PRECONDITION (CollCount (&LI->Fragments) == 0);
+
+ /* Free all the code ranges */
+ for (I = 0; I < CollCount (&LI->CodeRanges); ++I) {
+ FreeCodeRange (CollAtUnchecked (&LI->CodeRanges, I));
+ }
+
+ /* Free the collections */
+ DoneCollection (&LI->CodeRanges);
+
+ /* Free the structure itself */
+ xfree (LI);
+}
+
+
+
LineInfo* GenLineInfo (const FilePos* Pos)
/* Generate a new (internally used) line info with the given information */
{
-
+
LineInfo* GenLineInfo (const FilePos* Pos);
-/* Generate a new (internally used) line info with the given information */
+/* Generate a new (internally used) line info with the given information */
LineInfo* ReadLineInfo (FILE* F, struct ObjData* O);
/* Read a line info from a file and return it */
+void FreeLineInfo (LineInfo* LI);
+/* Free a LineInfo structure. This function will not handle a non empty
+ * Fragments collection, it can only be used to free incomplete line infos.
+ */
+
void ReadLineInfoList (FILE* F, struct ObjData* O, Collection* LineInfos);
/* Read a list of line infos stored as a list of indices in the object file,
* make real line infos from them and place them into the passed collection.
/* Unused ObjData do only have the string pool, Exports and Imports. */
for (I = 0; I < CollCount (&O->Exports); ++I) {
- FreeExport (CollAt (&O->Exports, I));
+ FreeExport (CollAtUnchecked (&O->Exports, I));
}
DoneCollection (&O->Exports);
for (I = 0; I < CollCount (&O->Imports); ++I) {
- FreeImport (CollAt (&O->Imports, I));
+ FreeImport (CollAtUnchecked (&O->Imports, I));
}
DoneCollection (&O->Imports);
DoneCollection (&O->DbgSyms);
+ for (I = 0; I < CollCount (&O->LineInfos); ++I) {
+ FreeLineInfo (CollAtUnchecked (&O->LineInfos, I));
+ }
DoneCollection (&O->LineInfos);
xfree (O->Strings);
DoneCollection (&O->Assertions);