mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
Some reformating of recent code, Daniel
This commit is contained in:
parent
8707604674
commit
3af3b596e3
51
xmllint.c
51
xmllint.c
@ -177,54 +177,63 @@ static int options = 0;
|
|||||||
* *
|
* *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
static void OOM(void) {
|
static void
|
||||||
|
OOM(void)
|
||||||
|
{
|
||||||
fprintf(stderr, "Ran out of memory needs > %d bytes\n", maxmem);
|
fprintf(stderr, "Ran out of memory needs > %d bytes\n", maxmem);
|
||||||
progresult = 9;
|
progresult = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void myFreeFunc(void *mem) {
|
static void
|
||||||
|
myFreeFunc(void *mem)
|
||||||
|
{
|
||||||
xmlMemFree(mem);
|
xmlMemFree(mem);
|
||||||
}
|
}
|
||||||
static void *myMallocFunc(size_t size) {
|
static void *
|
||||||
|
myMallocFunc(size_t size)
|
||||||
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
ret = xmlMemMalloc(size);
|
ret = xmlMemMalloc(size);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
if (xmlMemUsed() > maxmem) {
|
if (xmlMemUsed() > maxmem) {
|
||||||
OOM();
|
OOM();
|
||||||
xmlMemFree(ret);
|
xmlMemFree(ret);
|
||||||
return(NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
static void *myReallocFunc(void *mem, size_t size) {
|
static void *
|
||||||
|
myReallocFunc(void *mem, size_t size)
|
||||||
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
ret = xmlMemRealloc(mem, size);
|
ret = xmlMemRealloc(mem, size);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
if (xmlMemUsed() > maxmem) {
|
if (xmlMemUsed() > maxmem) {
|
||||||
OOM();
|
OOM();
|
||||||
xmlMemFree(ret);
|
xmlMemFree(ret);
|
||||||
return(NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
static char *myStrdupFunc(const char *str) {
|
static char *
|
||||||
|
myStrdupFunc(const char *str)
|
||||||
|
{
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
||||||
ret = xmlMemoryStrdup(str);
|
ret = xmlMemoryStrdup(str);
|
||||||
if (ret != NULL) {
|
if (ret != NULL) {
|
||||||
if (xmlMemUsed() > maxmem) {
|
if (xmlMemUsed() > maxmem) {
|
||||||
OOM();
|
OOM();
|
||||||
xmlFree(ret);
|
xmlFree(ret);
|
||||||
return(NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
* *
|
* *
|
||||||
* Internal timing routines to remove the necessity to have *
|
* Internal timing routines to remove the necessity to have *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user