1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00
Files
gnulib/modules/obstack
Paul Eggert 669cea8dce obstack: don’t assume INT_MAX < SIZE_MAX
This for clarity and to document the overflow checking better;
I think no current Gnulib or glibc targets have SIZE_MAX <= INTMAX,
so it shouldn’t change behavior on current targets.
* lib/obstack.c: Include stdckdint.h, not limits.h.
Remove no-longer needed ! (SIZE_MAX <= INT_MAX) check.
(align_chunk_size_up): Rename from align_size_up,
and change API to detect overflow directly.  All callers changed.
(align_chunk_size_up, _obstack_newchunk): Use ckd_add instead of
checking overflow by hand in a way that assumed INT_MAX < SIZE_MAX.
(call_chunkfun, _obstack_begin_worker, _obstack_newchunk):
Accept and use _OBSTACK_CHUNK_SIZE_T not size_t.  This affects
only glibc, since the two types are the same in Gnulib.  All
callers changed.
* modules/obstack (Depends-on): Add stdckdint-h.
2025-05-06 15:16:12 -07:00

61 lines
1.8 KiB
Plaintext

Description:
Memory allocation, optimized for stack-like allocation patterns.
Files:
lib/obstack.in.h
lib/obstack.c
m4/obstack.m4
Depends-on:
gen-header
alignasof [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
libc-config [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
flexmember [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
gettext-h [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
gnulib-i18n [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
exitfail [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
stdckdint-h [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
stddef-h [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
stdint-h [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
stdlib-h [test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1]
configure.ac:
gl_FUNC_OBSTACK
gl_CONDITIONAL_HEADER([obstack.h])
gl_CONDITIONAL([GL_COND_OBJ_OBSTACK],
[test $HAVE_OBSTACK = 0 || test $REPLACE_OBSTACK = 1])
AC_PROG_MKDIR_P
Makefile.am:
BUILT_SOURCES += $(OBSTACK_H)
# We need the following in order to create <obstack.h> when the system
# doesn't have one that works with any size object.
if GL_GENERATE_OBSTACK_H
obstack.h: obstack.in.h $(top_builddir)/config.status
@NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%'
$(gl_V_at)$(SED_HEADER_STDOUT) \
-e 's/defined __GL_GNULIB_HEADER/1/g' \
-e 's|defined __GL_REPLACE_OBSTACK__|$(REPLACE_OBSTACK)|g' \
-e 's|defined __GL_SMALL_PTRDIFF_T__|$(SMALL_PTRDIFF_T)|g' \
$(srcdir)/obstack.in.h > $@-t
$(AM_V_at)mv $@-t $@
else
obstack.h: $(top_builddir)/config.status
rm -f $@
endif
MOSTLYCLEANFILES += obstack.h obstack.h-t
if GL_COND_OBJ_OBSTACK
lib_SOURCES += obstack.c
endif
Include:
"obstack.h"
License:
LGPLv2+
Maintainer:
all, glibc