obstack/obstack_free: Fix incorrect usage of void* for arithmetics
Using void* for arithmetics is a GCC extension, and thus should not be used for portable code.
This commit is contained in:
parent
52228fd222
commit
4781379ee2
@ -66,10 +66,10 @@ FAR void *obstack_finish(FAR struct obstack *h)
|
||||
{
|
||||
chsize = h->next_free - (FAR char *)h->chunk;
|
||||
h->chunk = lib_obstack_realloc(h->chunk, chsize);
|
||||
h->chunk->limit = (FAR void *)h->chunk + chsize;
|
||||
h->chunk->limit = (FAR char *)h->chunk + chsize;
|
||||
h->object_base = h->chunk->limit;
|
||||
h->next_free = h->chunk->limit;
|
||||
return (FAR void *)h->chunk + sizeof(struct _obstack_chunk);
|
||||
return (FAR char *)h->chunk + sizeof(struct _obstack_chunk);
|
||||
}
|
||||
|
||||
return obstack_finish_norealloc(h);
|
||||
|
@ -51,7 +51,8 @@ void obstack_free(FAR struct obstack *h, FAR void *object)
|
||||
|
||||
while (h->chunk)
|
||||
{
|
||||
if (object >= (FAR void *)&h->chunk + sizeof(struct _obstack_chunk)
|
||||
if (object >=
|
||||
(FAR void *)((FAR char *)&h->chunk + sizeof(struct _obstack_chunk))
|
||||
&& object < (FAR void *)h->chunk->limit)
|
||||
{
|
||||
/* The object is in this chunk so just move object base.
|
||||
|
Loading…
Reference in New Issue
Block a user