mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
Added cleanup routines, cleanup with -pedantic on linux, closed #3788, Daniel
This commit is contained in:
23
encoding.c
23
encoding.c
@ -431,6 +431,29 @@ xmlInitCharEncodingHandlers(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCleanupCharEncodingHandlers:
|
||||
*
|
||||
* Cleanup the memory allocated for the char encoding support, it
|
||||
* unregisters all the encoding handlers.
|
||||
*/
|
||||
void
|
||||
xmlCleanupCharEncodingHandlers(void) {
|
||||
if (handlers == NULL) return;
|
||||
|
||||
for (;nbCharEncodingHandler > 0;) {
|
||||
nbCharEncodingHandler--;
|
||||
if (handlers[nbCharEncodingHandler] != NULL) {
|
||||
xmlFree(handlers[nbCharEncodingHandler]->name);
|
||||
xmlFree(handlers[nbCharEncodingHandler]);
|
||||
}
|
||||
}
|
||||
xmlFree(handlers);
|
||||
handlers = NULL;
|
||||
nbCharEncodingHandler = 0;
|
||||
xmlDefaultCharEncodingHandler = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlRegisterCharEncodingHandler:
|
||||
* @handler: the xmlCharEncodingHandlerPtr handler block
|
||||
|
Reference in New Issue
Block a user