summaryrefslogtreecommitdiff
path: root/lib/stack.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-06-11 17:18:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-06-11 17:20:13 -0700
commit3dc36216f168f4e752b648b19d85eab32a037827 (patch)
tree3ebd5d8d04256f8a20d15c8ab0424eadee838038 /lib/stack.h
parentd4e7edeb474203904b55ef575b3e57157c26e080 (diff)
downloadgnulib-3dc36216f168f4e752b648b19d85eab32a037827.tar.gz
stack: prefer idx_t for indexes
* lib/stack.h (_GL_STACK_TYPE, _GL_STACK_PREFIX): Prefer idx_t to size_t for indexes, using idx_t-related allocators.
Diffstat (limited to 'lib/stack.h')
-rw-r--r--lib/stack.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/stack.h b/lib/stack.h
index dfd57501f6..9c3afe724b 100644
--- a/lib/stack.h
+++ b/lib/stack.h
@@ -78,7 +78,7 @@ typedef struct
{
GL_STACK_ELEMENT *base;
size_t size;
- size_t allocated;
+ idx_t allocated;
} _GL_STACK_TYPE;
/* Initialize a stack. */
@@ -119,8 +119,8 @@ GL_STACK_STORAGECLASS void
_GL_STACK_PREFIX (push) (_GL_STACK_TYPE *stack, GL_STACK_ELEMENT item)
{
if (stack->size == stack->allocated)
- stack->base = x2nrealloc (stack->base, &stack->allocated,
- sizeof (GL_STACK_ELEMENT));
+ stack->base = xpalloc (stack->base, &stack->allocated, 1, -1,
+ sizeof *stack->base);;
stack->base [stack->size++] = item;
}