37 Commits

Author SHA1 Message Date
Jim Meyering
03ec9a1080 maint: update copyright dates 2026-01-02 17:33:20 -08:00
Jim Meyering
d3456f4482 maint: update all copyright dates via "make update-copyright" 2025-01-03 09:56:57 -08:00
Jim Meyering
2037812a6d maint: update copyright dates 2024-01-05 08:44:01 -08:00
Paul Eggert
fd9898dc4b maint: omit unnecessary Gnulib modules
* basicdefs.h: Do not include alloca.h.
* bootstrap.conf (gnulib_modules): Remove alloca, stdalign,
c-ctype, closeout, mbrlen, verify.
Add version-etc.
* lib/.gitignore, m4/.gitignore: Omit now-unused files.
* po/POTFILES.in: Remove closeout.c.
* testsuite/test-mbrtowc.c: Do not include closeout.h.
(main): Close stdout by hand, to avoid a dependency on closeout.
2023-01-30 09:58:54 -08:00
Jim Meyering
d81710cc8d maint: update copyright dates 2023-01-01 17:19:34 -08:00
Paul Eggert
a9b1b679b6 sed: improve integer overflow checking
Fix some some longstanding but unlikely integer overflows.
Internally, 'sed' now more often prefers signed integer arithmetic,
which can be checked automatically via 'gcc -fsanitize=undefined'.
* basicdefs.h (countT): Remove.  All uses replaced
with a more-specific signed type, e.g., idx_t.
Similarly, change uses of types like size_t to
signed types like idx_t when appropriate.
(REALLOC): Remove; no longer used.  We now use xpalloc
because that detects integer overflow in size calculations.
Also, we no longer use XCALLOC since the code never relies
on the storage being zero, and leaving it uninitialized is
more likely to catch errors when debugging implementations
are used.  We use XNMALLOC instead, or xpalloc.
* bootstrap.conf (gnulib_modules): Add stdckdint, strtoimax.
* lib/.gitignore, m4/.gitignore: Update for new Gnulib modules.
* sed/compile.c: Include stdckdint.h.
(VECTOR_ALLOC_INCREMENT): Remove; no longer used.
(in_integer): Return maximal value if integer overflow.
All callers changed to expect this.
(next_cmd_entry): Use xpalloc instead of reallocating by hand,
which might suffer integer overflow.
(normalize_text): Don’t rely on system-defined conversion
of out-of-range size_t to int.
(next_cmd_entry): Arg is now pointer, not pointer-to-pointer.
All uses changed.
* sed/debug.c (debug_print_function): Don’t attempt to
fwrite a null pointer with a zero size.
* sed/execute.c: Include <stdckdint.h>, "minmax.h".
(resize_line): LEN arg is now increment, not total length,
to avoid overflow when calculating total length.
All uses changed.  Do not assume lb->alloc * 2 cannot overflow.
(resize_line, line_copy): Use xpalloc instead of doing realloc by
hand, which might suffer integer overflow.
(str_append_modified): Do not add n to to->length until
after it's known this cannot overflow.
(read_file_line): Don’t assume ssize_t fits in long.
(get_backup_file_name): Don’t assume string length fits in int.
Do not assume PTR-1+1 works; behavior is undefined if PTR
is at buffer start.  Check for integer overflow in buffer
size calculation.
(read_pattern_space): Check for line number overflow.
(match_address_p): Check for address overflow.
(debug_print_line): Omit unnecessary test for in->active being null.
(execute_program): Check for Q overflow.
* sed/regexp.c: Include <stdckdint.h>.
(match_regex): Don’t assume TYPE_MAXIMUM (regoff_t) == INT_MAX.
* sed/sed.c: Include inttypes.h, for strtoimax.
(main): Use strtoimax, not atoi.
* sed/utils.c (init_buffer): Use xmalloc and xpalloc
instead of guessing sizes ourselves, and unnecessarily
initializing.
(resize_buffer): Remove; all callers changed to use xpalloc.
(free_buffer): Don’t call free (NULL), since we already
test whether the pointer is null.
2022-12-19 12:35:32 -08:00
Paul Eggert
2aa368b970 sed: simplify how diagnostics are translated
* basicdefs.h, sed/regexp.c (N_): Remove; no longer used.
* bootstrap.conf (XGETTEXT_OPTIONS):
Treat bad_prog as a function that translates its first arg.
Omit unnecessary flags.
* sed/compile.c, sed/regexp.c (errors): Remove this array of
concatenated strings, and associated macros.  All users of these
macros now simply call bad_prog ("diagnostic") instead of bad_prog
(_(DIAGNOSTIC_MACRO)).  This is easier to read and maintain, and
made it easy to catch two diagnostics that were never properly
translated before: "cannot specify modifiers on empty regexp",
"missing filename in r/R/w/W commands".
* sed/compile.c (bad_command): Remove; no longer used.
(vbad_prog): New function, with most of the old bad_prog contents.
(bad_prog): Now variadic, like printf.  Always translate WHY.
All callers changed.
(bad_prog_notranslate): New function.
2022-12-19 12:33:57 -08:00
Jim Meyering
0c8d88bc61 maint: make update-copyright 2022-01-01 15:00:18 -08:00
Assaf Gordon
71de42fd34 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* bootstrap.conf (gnulib_modules): Remove getopt module, depracated in
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=0abc38bd2a1398f0
* po/POTFILES.in: Remove getopt.c
* sed/utils.h (panic): Rename _GL_ATTRIBUTE_FORMAT_PRINTF to
_GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD following gnulib's change:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=387d654cabd7bc15
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2021-01-05 17:02:10 -07:00
Jim Meyering
623f5cd2f9 maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
2020-01-01 11:38:46 -08:00
Assaf Gordon
07df2c2e61 maint: update copyright dates for 2019
* all files: Run "make update-copyright".
2019-01-01 14:46:27 -07:00
Assaf Gordon
30192e7587 maint: replace street address with URL in license text
* basicdefs.h, sed/compile.c, sed/execute.c, sed/mbcs.c, sed/regexp.c,
sed/sed.c, sed/sed.h, sed/utils.c, sed/utils.h, testsuite/get-mb-cur-max.c,
testsuite/test-mbrtowc.c (GPL License notice): Replace FSF's office
address with 'https://www.gnu.org/licenses/'.
2018-08-23 14:34:17 -06:00
Assaf Gordon
f5364300a6 maint: syntax-check: add sc_prohibit_strncmp
* cfg.mk (sc_prohibit_strncmp): Copied from coreutils' cfg.mk.
* basicdefs.h (STREQ,STREQ_LEN,STRPREFIX): Copied from coreutils' system.h.
* sed/execute.c (translate_mb): Replace strncmp with STREQ_LEN.
2018-08-04 22:09:58 -06:00
Assaf Gordon
08b9f66a0c maint: syntax-check: space-before-open-paren
* cfg.mk (sc_space_before_open_paren): Copy target from coreutils' cfg.mk.
* basicdefs.h, sed/compile.c, sed/execute.c, sed/regexp.c,
sed/sed.c, sed/utils.c: Add space before parentheses.
2018-08-04 22:09:57 -06:00
Assaf Gordon
cd549fb19a sed: replace ck_realloc with gnulib's xrealloc/xnrealloc
* basicdefs.h (REALLOC): Call xnrealloc instead of ck_realloc.
* sed/utils.c (ck_realloc): Remove.
2018-08-03 20:02:39 -06:00
Assaf Gordon
e68a03d750 sed: replace MALLOC/ck_malloc with gnulib's XCALLOC
ck_malloc zero'd out the allocated buffer, thus replaced with
xcalloc/xzalloc (not xmalloc).

* basicdefs.h (MALLOC): Remove.
* utils.c (ck_malloc): Remove.
* sed/compile.c, sed/execute.c, sed/regexp.c, sed/sed.c: Replace
MALLOC with XCALLOC; ck_malloc with xzalloc.
2018-08-03 20:02:39 -06:00
Assaf Gordon
f593b21980 sed: replace ck_memdup with gnulib's xmemdup
* bootstrap.conf: Add gnulib's xalloc module.
* basicdefs.h (MEMDUP): Remove.
* sed/utils.{c,h} (ck_memdup): Remove.
2018-08-03 20:02:35 -06:00
Assaf Gordon
4d4c0d5ad0 maint: update gnulib and copyright dates for 2018
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2018-01-02 13:56:16 -07:00
Jim Meyering
1ceaa652a5 maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2017-01-01 03:17:39 -08:00
Jim Meyering
57f405ad56 maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...

* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
2016-01-01 15:02:20 -08:00
Jim Meyering
082b25cc3e maint: update copyright year ranges to include 2015; update gnulib 2015-01-01 19:18:17 -08:00
Jim Meyering
d15bafd704 maint: update copyright dates; use gnulib's update-copyright module
* bootstrap.conf (gnulib_modules): Add update-copyright.
Then, run "make update-copyright".
* Makefile.am: Add copyright header.
2014-11-30 18:59:32 -08:00
Jose E. Marchesi
7bb8d35d03 Set PATH_MAX to some constant in case it is not defined in system
headers.

2013-10-06  Jose E. Marchesi  <jemarch@gnu.org>

	* basicdefs.h (PATH_MAX): Defined to some constant in case it is
	not defined by system headers.
	* sed/utils.c: Do not include pathmax.h anymore.
	* bootstrap.conf (gnulib_modules): Do not use the gnulib module
	pathmax.
2013-10-06 14:43:38 +02:00
Paolo Bonzini
14bfbb5fa9 switch to the wonderful world of function prototypes
2012-03-16  Paolo Bonzini  <bonzini@gnu.org>

	* basicdefs.h (P_): Remove.
	* sed/compile.c: Adjust.
	* sed/execute.c: Likewise.
	* sed/fmt.c: Likewise.
	* sed/sed.c: Likewise.
	* sed/sed.h: Likewise.
	* sed/utils.c: Likewise.
	* sed/utils.h: Likewise.
2012-03-16 09:43:05 +01:00
Paolo Bonzini
9b1f7c3285 remove ck_free
2012-03-16  Paolo Bonzini  <bonzini@gnu.org>

	* basicdefs.h (FREE): Remove.
	* sed/compile.c: Adjust.
	* sed/execute.c: Adjust.
	* sed/regexp.c: Adjust.
	* sed/utils.c: Adjust, remove ck_free.
	* sed/utils.h: Adjust, remove ck_free.
2012-03-16 09:43:04 +01:00
Paolo Bonzini
40c84e138a rip out old macros
2012-03-16  Paolo Bonzini  <bonzini@gnu.org>

	* basicdefs.h (CAST, VCAST, VOID, MEMCPY, MEMMOVE): Rip out.
	* sed/compile.c: Adjust.
	* sed/execute.c: Adjust.
	* sed/regexp.c: Adjust.
	* sed/utils.c: Adjust.
	* sed/utils.h: Adjust.
2012-03-16 09:43:02 +01:00
Paolo Bonzini
9ea38da9fb clean up header inclusions
2012-03-16  Paolo Bonzini  <bonzini@gnu.org>

	* basicdefs.h: Enjoy gnulib's headers.
	* sed/compile.c: Likewise.
	* sed/execute.c: Likewise.
	* sed/regexp.c: Likewise.
	* sed/sed.c: Likewise.
	* sed/sed.h: Likewise.
	* sed/utils.c: Likewise.
2012-03-16 09:43:01 +01:00
Paolo Bonzini
944747af30 remove bootstrap script
2012-03-16  Paolo Bonzini  <bonzini@gnu.org>

	* bootstrap.sh.in: Remove.
	* bootstrap.sh: Remove.
	* configure.ac: Do not create bootstrap.sh.
	* basicdefs.h [BOOTSTRAP]: Remove guards.
	* sed/execute.c [BOOTSTRAP]: Remove guards.
	* sed/sed.c [BOOTSTRAP]: Remove guards.
	* sed/sed.h [BOOTSTRAP]: Remove guards.
2012-03-16 09:43:00 +01:00
Eric Blake
d7b21d511a avoid compiler warning
* sed/sed.c (includes): Supply missing header.
2010-11-03 17:13:12 +01:00
Jim Meyering
51d634a52f switch to external gettext
2008-10-03  Paolo Bonzini  <bonzini@gnu.org>
	    Jim Meyering  <meyering@redhat.com>

	* Makefile.am: Remove intl subdir.  Require Automake 1.10.
	* configure.ac: Remove useless macros, switch to external gettext.
	* lib/Makefile.am: Remove intl subdir from CPPFLAGS.
	* sed/Makefile.am: Remove intl subdir from CPPFLAGS.
2008-10-03 10:34:54 +02:00
Paolo Bonzini
07df2df3c2 update gnulib
2008-09-28  Paolo Bonzini  <bonzini@gnu.org>

	* basicdefs.h: Replace alloca cruft with alloca.h.
	* bootstrap.sh.in: Update for new gnulib.
	* bootstrap.sh: Update for new gnulib.
	* configure.ac: Move gnulib macros earlier.
	* sed/execute.c: Do not include acl.h when bootstrapping.
2008-09-28 18:47:58 +02:00
Paolo Bonzini
5204cc981d don't hardcode usage of prototypes on SunStudio
2008-06-04  Vladimir Marek  <vladimir.marek@sun.com>

	* basicdefs.h: Don't hardcode usage of prototypes on SunStudio.
2008-06-04 17:00:31 +02:00
Paolo Bonzini
3cfe7fdf8a Fix compilation on non-GCC compilers, update po files
2006-05-15  Hans-Bernhard Bröker <broeker@physik.rwth-aachen.de>

	* sed/basicdefs.h (OB_MALLOC): Turn VCAST into void * cast.

git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-66
2008-01-09 16:12:07 +01:00
Paolo Bonzini
584e5cedc2 more updates to the FSF address
git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-50
2008-01-09 16:11:53 +01:00
Paolo Bonzini
07e543c45f update FSF address
git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-49
2008-01-09 16:11:52 +01:00
Paolo Bonzini
fd8f5daad7 more portability improvements
2004-11-11  Paolo Bonzini  <bonzini@gnu

	* tst-rxspecer.c: Do not mix instructions and
	declarations.
	* basicdefs.h: Include locale.h before #defining
	gettext, to avoid breakage under Solaris.
	* sed/sed.c: do not include locale.h.

po:
2004-11-11  Paolo Bonzini  <bonzini@gnu.org>

	* Makevars: New.

git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-18
2008-01-09 16:10:52 +01:00
Paolo Bonzini
9c9919efe2 initial import
(automatically generated log message)

git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--base-0
2004-10-20 21:42:31 +00:00