home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
Linux
/
Enlightenment
/
enl14.tgz
/
enl14.tar
/
enl14
/
misc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-11-06
|
923b
|
65 lines
#include "enl.h"
void EExit(int code)
{
char s[1024];
if ((ThemeDir)&&(ThemeIsTmp))
{
sprintf(s,"/bin/rm -rf %s",ThemeDir);
system(s);
}
exit(code);
}
void *Emalloc(int size)
{
void *p;
p=NULL;
if (size<=0)
{
Alert("Warning! Attempt to malloc 0 bytes\n");
return NULL;
}
else
{
p=malloc(size);
if (!p) Alert("Warning! malloc for %i bytes failed\n",size);
return p;
}
}
void *Erealloc(void *ptr, int size)
{
void *p;
p=NULL;
if (size<=0)
{
Alert("Warning! Attempt to realloc 0 bytes\n");
Efree(ptr);
return NULL;
}
else if (ptr==NULL)
{
return Emalloc(size);
}
else
{
p=realloc(ptr,size);
if (!p) Alert("Warning! realloc for %i bytes failed\n",size);
return p;
}
}
void Efree(void *ptr)
{
if (!ptr)
Alert("Warning! Attempting to free NULL pointer\n");
else
{
free(ptr);
}
}