diff --git a/src/ChangeLog b/src/ChangeLog index 432ed262..772d4eb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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. diff --git a/src/E.h b/src/E.h index 4d256b35..7a5e4cbd 100644 --- a/src/E.h +++ b/src/E.h @@ -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, "", 0) #define Emalloc(x) \ -malloc(x) +__Emalloc(x, "", 0) #define Erealloc(x, y) \ -realloc(x, y) +__Erealloc(x, y, "", 0) #endif char *duplicate(char *s); diff --git a/src/evhandlers.c b/src/evhandlers.c index f5c8e745..72830983 100644 --- a/src/evhandlers.c +++ b/src/evhandlers.c @@ -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++) diff --git a/src/memory.c b/src/memory.c index 7648f1e9..3fcf6110 100644 --- a/src/memory.c +++ b/src/memory.c @@ -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;