Removed some HEAP_xalloc calls.

This commit is contained in:
Dimitrie O. Paun 2000-04-29 14:20:28 +00:00 committed by Alexandre Julliard
parent d34abdd158
commit abdbced4fd
5 changed files with 45 additions and 20 deletions

View File

@ -178,16 +178,23 @@ HFILE WINAPI LZInit( HFILE hfSrc )
for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break;
if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC;
lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), 0, sizeof(struct lzstate) );
if(lzs == NULL) return LZERROR_GLOBALLOC;
memset(lzs,'\0',sizeof(*lzs));
lzs->realfd = hfSrc;
lzs->lastchar = head.lastchar;
lzs->reallength = head.reallength;
lzs->get = HEAP_xalloc( GetProcessHeap(), 0, GETLEN );
lzs->get = HeapAlloc( GetProcessHeap(), 0, GETLEN );
lzs->getlen = 0;
lzs->getcur = 0;
if(lzs->get == NULL) {
HeapFree(GetProcessHeap(), 0, lzs);
lzstates[i] = NULL;
return LZERROR_GLOBALLOC;
}
/* Yes, preinitialize with spaces */
memset(lzs->table,' ',0x1000);
/* 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 )
{
char *p;
char *mfn = (char *)HEAP_xalloc( GetProcessHeap(), 0,
char *mfn = (char *)HeapAlloc( GetProcessHeap(), 0,
strlen(fn) + 3 ); /* "._" and \0 */
if(mfn == NULL) return NULL;
strcpy( mfn, fn );
if (!(p = strrchr( mfn, '\\' ))) p = mfn;
if ((p = strchr( p, '.' )))

View File

@ -992,7 +992,7 @@ DWORD WINAPI GetShortPathNameW( LPCWSTR longpath, LPWSTR shortpath,
DWORD ret = 0;
longpathA = HEAP_strdupWtoA( GetProcessHeap(), 0, longpath );
shortpathA = HEAP_xalloc ( GetProcessHeap(), 0, shortlen );
shortpathA = HeapAlloc ( GetProcessHeap(), 0, shortlen );
ret = GetShortPathNameA ( longpathA, 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)
{
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);
lstrcpynAtoW(target,targetA,bufsize);

View File

@ -202,7 +202,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
PROFILESECTION **next_section;
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->key = NULL;
first_section->next = NULL;
@ -226,7 +227,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
{
*p2 = '\0';
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->key = NULL;
section->next = NULL;
@ -254,7 +256,8 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
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->value = p2 ? HEAP_strdupA( GetProcessHeap(), 0, p2 ) : NULL;
key->next = NULL;
@ -426,7 +429,8 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
key = &(*key)->next;
}
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)->value = NULL;
(*key)->next = NULL;
@ -435,10 +439,16 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
section = &(*section)->next;
}
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)->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->value = NULL;
(*section)->key->next = NULL;
@ -535,7 +545,8 @@ static BOOL PROFILE_Open( LPCSTR filename )
if(!CurProfile)
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]->section=NULL;
MRUProfile[i]->dos_name=NULL;

View File

@ -712,11 +712,15 @@ BOOL16 WINAPI PolyPolygon16( HDC16 hdc, const POINT16* pt, const INT16* counts,
nrpts=0;
for (i=polygons;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--;)
CONV_POINT16TO32(&(pt[i]),&(pt32[i]));
counts32 = (LPINT)HEAP_xalloc( GetProcessHeap(), 0,
polygons*sizeof(INT) );
counts32 = (LPINT)HeapAlloc( GetProcessHeap(), 0, polygons*sizeof(INT) );
if(counts32 == NULL) {
HeapFree( GetProcessHeap(), 0, pt32 );
return FALSE;
}
for (i=polygons;i--;) counts32[i]=counts[i];
ret = PolyPolygon(hdc,pt32,counts32,polygons);

View File

@ -984,7 +984,8 @@ static Atom EVENT_SelectionRequest_TARGETS( Window requestor, Atom target, Atom
cTargets++;
/* 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) */
@ -1080,7 +1081,8 @@ static Atom EVENT_SelectionRequest_STRING( Window requestor, Atom target, Atom r
size = GlobalSize16(hText);
/* 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++ )
{
if( text[i] == '\r' &&