Removed some HEAP_xalloc calls.
This commit is contained in:
parent
d34abdd158
commit
abdbced4fd
|
@ -178,16 +178,23 @@ HFILE WINAPI LZInit( HFILE hfSrc )
|
||||||
for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break;
|
for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break;
|
||||||
if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC;
|
if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC;
|
||||||
lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), 0, sizeof(struct lzstate) );
|
lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), 0, sizeof(struct lzstate) );
|
||||||
|
if(lzs == NULL) return LZERROR_GLOBALLOC;
|
||||||
|
|
||||||
memset(lzs,'\0',sizeof(*lzs));
|
memset(lzs,'\0',sizeof(*lzs));
|
||||||
lzs->realfd = hfSrc;
|
lzs->realfd = hfSrc;
|
||||||
lzs->lastchar = head.lastchar;
|
lzs->lastchar = head.lastchar;
|
||||||
lzs->reallength = head.reallength;
|
lzs->reallength = head.reallength;
|
||||||
|
|
||||||
lzs->get = HEAP_xalloc( GetProcessHeap(), 0, GETLEN );
|
lzs->get = HeapAlloc( GetProcessHeap(), 0, GETLEN );
|
||||||
lzs->getlen = 0;
|
lzs->getlen = 0;
|
||||||
lzs->getcur = 0;
|
lzs->getcur = 0;
|
||||||
|
|
||||||
|
if(lzs->get == NULL) {
|
||||||
|
HeapFree(GetProcessHeap(), 0, lzs);
|
||||||
|
lzstates[i] = NULL;
|
||||||
|
return LZERROR_GLOBALLOC;
|
||||||
|
}
|
||||||
|
|
||||||
/* Yes, preinitialize with spaces */
|
/* Yes, preinitialize with spaces */
|
||||||
memset(lzs->table,' ',0x1000);
|
memset(lzs->table,' ',0x1000);
|
||||||
/* Yes, start 16 byte from the END of the table */
|
/* Yes, start 16 byte from the END of the table */
|
||||||
|
@ -534,8 +541,9 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest )
|
||||||
static LPSTR LZEXPAND_MangleName( LPCSTR fn )
|
static LPSTR LZEXPAND_MangleName( LPCSTR fn )
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
char *mfn = (char *)HEAP_xalloc( GetProcessHeap(), 0,
|
char *mfn = (char *)HeapAlloc( GetProcessHeap(), 0,
|
||||||
strlen(fn) + 3 ); /* "._" and \0 */
|
strlen(fn) + 3 ); /* "._" and \0 */
|
||||||
|
if(mfn == NULL) return NULL;
|
||||||
strcpy( mfn, fn );
|
strcpy( mfn, fn );
|
||||||
if (!(p = strrchr( mfn, '\\' ))) p = mfn;
|
if (!(p = strrchr( mfn, '\\' ))) p = mfn;
|
||||||
if ((p = strchr( p, '.' )))
|
if ((p = strchr( p, '.' )))
|
||||||
|
|
|
@ -992,7 +992,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath,
|
||||||
DWORD ret = 0;
|
DWORD ret = 0;
|
||||||
|
|
||||||
longpathA = HEAP_strdupWtoA( GetProcessHeap(), 0, longpath );
|
longpathA = HEAP_strdupWtoA( GetProcessHeap(), 0, longpath );
|
||||||
shortpathA = HEAP_xalloc ( GetProcessHeap(), 0, shortlen );
|
shortpathA = HeapAlloc ( GetProcessHeap(), 0, shortlen );
|
||||||
|
|
||||||
ret = GetShortPathNameA ( longpathA, shortpathA, shortlen );
|
ret = GetShortPathNameA ( longpathA, shortpathA, shortlen );
|
||||||
lstrcpynAtoW ( shortpath, shortpathA, shortlen );
|
lstrcpynAtoW ( shortpath, shortpathA, shortlen );
|
||||||
|
@ -1953,7 +1953,7 @@ DWORD WINAPI QueryDosDeviceA(LPCSTR devname,LPSTR target,DWORD bufsize)
|
||||||
DWORD WINAPI QueryDosDeviceW(LPCWSTR devname,LPWSTR target,DWORD bufsize)
|
DWORD WINAPI QueryDosDeviceW(LPCWSTR devname,LPWSTR target,DWORD bufsize)
|
||||||
{
|
{
|
||||||
LPSTR devnameA = devname?HEAP_strdupWtoA(GetProcessHeap(),0,devname):NULL;
|
LPSTR devnameA = devname?HEAP_strdupWtoA(GetProcessHeap(),0,devname):NULL;
|
||||||
LPSTR targetA = (LPSTR)HEAP_xalloc(GetProcessHeap(),0,bufsize);
|
LPSTR targetA = (LPSTR)HeapAlloc(GetProcessHeap(),0,bufsize);
|
||||||
DWORD ret = QueryDosDeviceA(devnameA,targetA,bufsize);
|
DWORD ret = QueryDosDeviceA(devnameA,targetA,bufsize);
|
||||||
|
|
||||||
lstrcpynAtoW(target,targetA,bufsize);
|
lstrcpynAtoW(target,targetA,bufsize);
|
||||||
|
|
|
@ -202,7 +202,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
||||||
PROFILESECTION **next_section;
|
PROFILESECTION **next_section;
|
||||||
PROFILEKEY *key, *prev_key, **next_key;
|
PROFILEKEY *key, *prev_key, **next_key;
|
||||||
|
|
||||||
first_section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*section) );
|
first_section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) );
|
||||||
|
if(first_section == NULL) return NULL;
|
||||||
first_section->name = NULL;
|
first_section->name = NULL;
|
||||||
first_section->key = NULL;
|
first_section->key = NULL;
|
||||||
first_section->next = NULL;
|
first_section->next = NULL;
|
||||||
|
@ -226,7 +227,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
||||||
{
|
{
|
||||||
*p2 = '\0';
|
*p2 = '\0';
|
||||||
p++;
|
p++;
|
||||||
section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*section) );
|
section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) );
|
||||||
|
if(section == NULL) break;
|
||||||
section->name = HEAP_strdupA( GetProcessHeap(), 0, p );
|
section->name = HEAP_strdupA( GetProcessHeap(), 0, p );
|
||||||
section->key = NULL;
|
section->key = NULL;
|
||||||
section->next = NULL;
|
section->next = NULL;
|
||||||
|
@ -253,8 +255,9 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*p || !prev_key || *prev_key->name)
|
if(*p || !prev_key || *prev_key->name)
|
||||||
{
|
{
|
||||||
key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(*key) );
|
key = HeapAlloc( GetProcessHeap(), 0, sizeof(*key) );
|
||||||
|
if(key == NULL) break;
|
||||||
key->name = HEAP_strdupA( GetProcessHeap(), 0, p );
|
key->name = HEAP_strdupA( GetProcessHeap(), 0, p );
|
||||||
key->value = p2 ? HEAP_strdupA( GetProcessHeap(), 0, p2 ) : NULL;
|
key->value = p2 ? HEAP_strdupA( GetProcessHeap(), 0, p2 ) : NULL;
|
||||||
key->next = NULL;
|
key->next = NULL;
|
||||||
|
@ -263,7 +266,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
|
||||||
prev_key = key;
|
prev_key = key;
|
||||||
|
|
||||||
TRACE("New key: name='%s', value='%s'\n",key->name,key->value?key->value:"(none)");
|
TRACE("New key: name='%s', value='%s'\n",key->name,key->value?key->value:"(none)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return first_section;
|
return first_section;
|
||||||
}
|
}
|
||||||
|
@ -426,7 +429,8 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
|
||||||
key = &(*key)->next;
|
key = &(*key)->next;
|
||||||
}
|
}
|
||||||
if (!create) return NULL;
|
if (!create) return NULL;
|
||||||
*key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
|
*key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
|
||||||
|
if(*key == NULL) return NULL;
|
||||||
(*key)->name = HEAP_strdupA( GetProcessHeap(), 0, key_name );
|
(*key)->name = HEAP_strdupA( GetProcessHeap(), 0, key_name );
|
||||||
(*key)->value = NULL;
|
(*key)->value = NULL;
|
||||||
(*key)->next = NULL;
|
(*key)->next = NULL;
|
||||||
|
@ -435,10 +439,16 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
|
||||||
section = &(*section)->next;
|
section = &(*section)->next;
|
||||||
}
|
}
|
||||||
if (!create) return NULL;
|
if (!create) return NULL;
|
||||||
*section = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) );
|
*section = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) );
|
||||||
|
if(*section == NULL) return NULL;
|
||||||
(*section)->name = HEAP_strdupA( GetProcessHeap(), 0, section_name );
|
(*section)->name = HEAP_strdupA( GetProcessHeap(), 0, section_name );
|
||||||
(*section)->next = NULL;
|
(*section)->next = NULL;
|
||||||
(*section)->key = HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
|
(*section)->key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) );
|
||||||
|
if((*section)->key == NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(), 0, *section);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
(*section)->key->name = HEAP_strdupA( GetProcessHeap(), 0, key_name );
|
(*section)->key->name = HEAP_strdupA( GetProcessHeap(), 0, key_name );
|
||||||
(*section)->key->value = NULL;
|
(*section)->key->value = NULL;
|
||||||
(*section)->key->next = NULL;
|
(*section)->key->next = NULL;
|
||||||
|
@ -535,7 +545,8 @@ static BOOL PROFILE_Open( LPCSTR filename )
|
||||||
if(!CurProfile)
|
if(!CurProfile)
|
||||||
for(i=0;i<N_CACHED_PROFILES;i++)
|
for(i=0;i<N_CACHED_PROFILES;i++)
|
||||||
{
|
{
|
||||||
MRUProfile[i]=HEAP_xalloc( GetProcessHeap(), 0, sizeof(PROFILE) );
|
MRUProfile[i]=HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILE) );
|
||||||
|
if(MRUProfile[i] == NULL) break;
|
||||||
MRUProfile[i]->changed=FALSE;
|
MRUProfile[i]->changed=FALSE;
|
||||||
MRUProfile[i]->section=NULL;
|
MRUProfile[i]->section=NULL;
|
||||||
MRUProfile[i]->dos_name=NULL;
|
MRUProfile[i]->dos_name=NULL;
|
||||||
|
|
|
@ -712,11 +712,15 @@ BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
|
||||||
nrpts=0;
|
nrpts=0;
|
||||||
for (i=polygons;i--;)
|
for (i=polygons;i--;)
|
||||||
nrpts+=counts[i];
|
nrpts+=counts[i];
|
||||||
pt32 = (LPPOINT)HEAP_xalloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
|
pt32 = (LPPOINT)HeapAlloc( GetProcessHeap(), 0, sizeof(POINT)*nrpts);
|
||||||
|
if(pt32 == NULL) return FALSE;
|
||||||
for (i=nrpts;i--;)
|
for (i=nrpts;i--;)
|
||||||
CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
|
CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
|
||||||
counts32 = (LPINT)HEAP_xalloc( GetProcessHeap(), 0,
|
counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
|
||||||
polygons*sizeof(INT) );
|
if(counts32 == NULL) {
|
||||||
|
HeapFree( GetProcessHeap(), 0, pt32 );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
for (i=polygons;i--;) counts32[i]=counts[i];
|
for (i=polygons;i--;) counts32[i]=counts[i];
|
||||||
|
|
||||||
ret = PolyPolygon(hdc,pt32,counts32,polygons);
|
ret = PolyPolygon(hdc,pt32,counts32,polygons);
|
||||||
|
|
|
@ -984,7 +984,8 @@ static Atom EVENT_SelectionRequest_TARGETS( Window requestor, Atom target, Atom
|
||||||
cTargets++;
|
cTargets++;
|
||||||
|
|
||||||
/* Allocate temp buffer */
|
/* Allocate temp buffer */
|
||||||
targets = (Atom*)HEAP_xalloc( GetProcessHeap(), 0, cTargets * sizeof(Atom));
|
targets = (Atom*)HeapAlloc( GetProcessHeap(), 0, cTargets * sizeof(Atom));
|
||||||
|
if(targets == NULL) return None;
|
||||||
|
|
||||||
/* Create TARGETS property list (First item in list is TARGETS itself) */
|
/* Create TARGETS property list (First item in list is TARGETS itself) */
|
||||||
|
|
||||||
|
@ -1080,7 +1081,8 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r
|
||||||
size = GlobalSize16(hText);
|
size = GlobalSize16(hText);
|
||||||
/* remove carriage returns */
|
/* remove carriage returns */
|
||||||
|
|
||||||
lpstr = (char*)HEAP_xalloc( GetProcessHeap(), 0, size-- );
|
lpstr = (char*)HeapAlloc( GetProcessHeap(), 0, size-- );
|
||||||
|
if(lpstr == NULL) return None;
|
||||||
for(i=0,j=0; i < size && text[i]; i++ )
|
for(i=0,j=0; i < size && text[i]; i++ )
|
||||||
{
|
{
|
||||||
if( text[i] == '\r' &&
|
if( text[i] == '\r' &&
|
||||||
|
|
Loading…
Reference in New Issue