forked from e16/e16
1
0
Fork 0

Fri Sep 17 11:29:07 PDT 1999

(KainX)

Changes to the memory allocation stuff to make it more portable and
such.  Account for all the different ways they could be called and
do the rerouting ourselves so we don't depend on the OS.


SVN revision: 309
This commit is contained in:
Michael Jennings 1999-09-17 17:38:51 +00:00
parent 7e4486946c
commit daaeaa9b3a
4 changed files with 27 additions and 9 deletions

View File

@ -1925,3 +1925,12 @@ handle icon property change events properly and redraw iconbox if window
iconfied.
fixed up 2 images in brushed metal theme + add right side pager border
-------------------------------------------------------------------------------
Fri Sep 17 11:29:07 PDT 1999
(KainX)
Changes to the memory allocation stuff to make it more portable and
such. Account for all the different ways they could be called and
do the rerouting ourselves so we don't depend on the OS.

View File

@ -2552,12 +2552,13 @@ void *__Erealloc(void *ptr, int size, const char *file, int line);
void __Efree(void *ptr, const char *file, int line);
#else
/* We still want our special handling, even if they don't have file/line stuff -- mej */
#define Efree(x) \
free(x);
__Efree(x, "<unknown>", 0)
#define Emalloc(x) \
malloc(x)
__Emalloc(x, "<unknown>", 0)
#define Erealloc(x, y) \
realloc(x, y)
__Erealloc(x, y, "<unknown>", 0)
#endif
char *duplicate(char *s);

View File

@ -1024,10 +1024,10 @@ HandleProperty(XEvent * ev)
}
if (ewin->iconified)
{
Iconbox **ib;
int i, j, num;
ib = (Iconbox **)ListItemType(&num, LIST_TYPE_ICONBOX);
Iconbox **ib;
int i, j, num;
ib = (Iconbox **) ListItemType(&num, LIST_TYPE_ICONBOX);
if (ib)
{
for (i = 0; i < num; i++)

View File

@ -44,6 +44,8 @@ __Emalloc(int size, const char *file, int line)
void *p;
EDBUG(9, "Emalloc");
if (size <= 0)
return NULL;
p = malloc(size);
if (!p)
{
@ -110,8 +112,14 @@ __Erealloc(void *ptr, int size, const char *file, int line)
#endif
if (ptr == NULL)
return __Emalloc(size, file, line);
if ((ptr != NULL) && (size == 0))
{
if (size > 0)
return __Emalloc(size, file, line);
else
return NULL;
}
/* If we get here, we know ptr != NULL, so don't test for that case -- mej */
if (size <= 0)
{
__Efree(ptr, file, line);
return NULL;