+void FreeAttr (Attr* A)
+/* Free an attribute structure */
+{
+ /* Allow NULL pointers */
+ if (A) {
+ xfree (A->Name);
+ xfree (A);
+ }
+}
+
+
+
void DumpAttrColl (const Collection* C)
/* Dump a collection of attribute/value pairs for debugging */
{
/* Release memory */
SB_Done (&N);
- }
+ }
}
+void FreeAttrList (Collection* C)
+/* Free a list of attributes */
+{
+ unsigned I;
+
+ /* Walk over the collection and free all attributes */
+ for (I = 0; I < CollCount (C); ++I) {
+ FreeAttr (CollAtUnchecked (C, I));
+ }
+
+ /* Free the collection itself */
+ FreeCollection (C);
+}
+
+
+
Attr* NewAttr (const char* Name, const char* Value);
/* Create a new attribute */
+void FreeAttr (Attr* A);
+/* Free an attribute structure */
+
void DumpAttrColl (const Collection* C);
/* Dump a collection of attribute/value pairs for debugging */
const Attr* NeedAttr (const Collection* C, const char* Name, const char* Op);
/* Search for an attribute with the given name and return it. If the attribute
- * is not found, the function terminates with an error using Op as additional
+ * is not found, the function terminates with an error using Op as additional
* context in the error message.
*/
* containing Attr entries.
*/
+void FreeAttrList (Collection* C);
+/* Free a list of attributes */
+
/* End of attr.h */
{
/* Alloc NULL pointers */
if (B != 0) {
- /* Free the palette and then the bitmap */
+ /* Free name, palette and then the bitmap */
+ SB_Done (&B->Name);
xfree (B->Pal);
xfree(B);
}
case bmRGB:
case bmRGBA: return (1U << 24);
default: Internal ("Unknown bitmap type %u", B->Type);
- }
+ }
/* NOTREACHED */
return 0;
}
SetOutputData (ConvertTo (C, A));
/* Delete the attribute list */
- FreeCollection (A);
+ FreeAttrList (A);
}
B = C = ReadInputFile (A);
/* Delete the attribute list */
- FreeCollection (A);
+ FreeAttrList (A);
}
WriteOutputFile (D, A);
/* Delete the attribute list */
- FreeCollection (A);
+ FreeAttrList (A);
}
/* Close the file */
fclose (F);
+ /* Free memory for the scan line */
+ xfree (L);
+
/* Free the PCX header */
FreePCXHeader (P);