mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 17:12:03 +00:00
Fix for xml on mingw32
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20736 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
bdad1bf7e0
commit
c66073233b
2 changed files with 13 additions and 1 deletions
|
@ -6,6 +6,9 @@
|
||||||
requires iconv (which it usually will on a system where iconv is
|
requires iconv (which it usually will on a system where iconv is
|
||||||
not built into the standard c library).
|
not built into the standard c library).
|
||||||
* confingure: Regenerate
|
* confingure: Regenerate
|
||||||
|
* Source/Additions/GSXML.m: Set memory allocation functions to be
|
||||||
|
used by libxml2, so we can use objc_free() to release strings returned
|
||||||
|
by the library, and avoid linker problem with xmlFree() on mingw.
|
||||||
|
|
||||||
2005-02-15 08:00 Richard Frith-Macdonald <rfm@gnu.org>
|
2005-02-15 08:00 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,21 @@ static BOOL cacheDone = NO;
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char * objc_strdup(const char *from)
|
||||||
|
{
|
||||||
|
unsigned len = (from == 0) ? 1 : (strlen(from) + 1);
|
||||||
|
char *to = objc_malloc(len);
|
||||||
|
strcpy(to, from);
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
setupCache()
|
setupCache()
|
||||||
{
|
{
|
||||||
if (cacheDone == NO)
|
if (cacheDone == NO)
|
||||||
{
|
{
|
||||||
cacheDone = YES;
|
cacheDone = YES;
|
||||||
|
xmlMemSetup(objc_free, objc_malloc, objc_realloc, objc_strdup);
|
||||||
|
|
||||||
#if HAVE_LIBXML_SAX2_H
|
#if HAVE_LIBXML_SAX2_H
|
||||||
xmlDefaultSAXHandlerInit();
|
xmlDefaultSAXHandlerInit();
|
||||||
|
@ -376,7 +385,7 @@ static NSMapTable *attrNames = 0;
|
||||||
if (buf != 0 && length > 0)
|
if (buf != 0 && length > 0)
|
||||||
{
|
{
|
||||||
string = UTF8StrLen(buf, length);
|
string = UTF8StrLen(buf, length);
|
||||||
xmlFree(buf);
|
objc_free(buf);
|
||||||
}
|
}
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue