unbreak with dietlibc, whose <stdint.h> has no SIZE_MAX, defying SUSv3
This commit is contained in:
parent
0d254e4088
commit
004b3b1e08
17
lalloc.c
17
lalloc.c
@ -1,6 +1,6 @@
|
|||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.1 2009/03/22 16:55:38 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.2 2009/03/23 09:08:35 tg Exp $");
|
||||||
|
|
||||||
struct lalloc {
|
struct lalloc {
|
||||||
struct lalloc *next; /* entry pointer, must be first */
|
struct lalloc *next; /* entry pointer, must be first */
|
||||||
@ -33,10 +33,10 @@ aresize(void *ptr, size_t numb, Area *ap)
|
|||||||
{
|
{
|
||||||
struct lalloc *lp, *pp;
|
struct lalloc *lp, *pp;
|
||||||
|
|
||||||
|
#ifdef SIZE_MAX
|
||||||
if (numb >= SIZE_MAX - sizeof (struct lalloc))
|
if (numb >= SIZE_MAX - sizeof (struct lalloc))
|
||||||
failure:
|
goto failure;
|
||||||
internal_errorf("cannot allocate %lu data bytes",
|
#endif
|
||||||
(unsigned long)numb);
|
|
||||||
|
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
pp = (struct lalloc *)ap;
|
pp = (struct lalloc *)ap;
|
||||||
@ -45,8 +45,13 @@ aresize(void *ptr, size_t numb, Area *ap)
|
|||||||
findptr(&lp, &pp, ptr, ap);
|
findptr(&lp, &pp, ptr, ap);
|
||||||
lp = realloc(lp, numb + sizeof (struct lalloc));
|
lp = realloc(lp, numb + sizeof (struct lalloc));
|
||||||
}
|
}
|
||||||
if (lp == NULL)
|
if (lp == NULL) {
|
||||||
goto failure;
|
#ifdef SIZE_MAX
|
||||||
|
failure:
|
||||||
|
#endif
|
||||||
|
internal_errorf("cannot allocate %lu data bytes",
|
||||||
|
(unsigned long)numb);
|
||||||
|
}
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
lp->group = ap;
|
lp->group = ap;
|
||||||
lp->next = ap->ent;
|
lp->next = ap->ent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user