aboutsummaryrefslogtreecommitdiffstats
path: root/src/set-fields.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2025-09-17maint: STREQ → streqPaul Eggert1-1/+1
Use new Gnulib streq function instead of rolling our own macro. * bootstrap.conf (gnulib_modules): Add stringeq. * src/rm.c (main): Don’t assume streq is a macro that expands to (...), as it is now a function. * src/system.h: * tests/df/no-mtab-status.sh, tests/df/skip-duplicates.sh: (STREQ): Remove. All uses replaced by streq.
2025-06-22maint: use _GL_CMP instead of handwriting three-valued comparisonsCollin Funk1-1/+1
* src/comm.c (compare_files): Use _GL_CMP. * src/join.c (keycmp): Likewise. * src/ls.c (off_cmp): Likewise. * src/ptx.c (compare_words, compare_occurs): Likewise. * src/set-fields.c (compare_ranges): Likewise. * src/sort.c (compare_random, diff_reversed, compare): Likewise.
2025-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Likewise. * tests/sample-test: Adjust to use the single most recent year.
2024-12-30maint: ISDIGIT → c_isdigitPaul Eggert1-1/+2
* gl/lib/strnumcmp-in.h (ISDIGIT): * src/system.h (ISDIGIT): Remove. All uses replaced by c_isdigit, with appropriate inclusions of c-ctype.h. This is more regular, and is more portable to existing (but unlikely) platforms where INT_MAX == UINT_MAX.
2024-11-08cut,numfmt: prefer xpalloc to x2nreallocPaul Eggert1-10/+9
* src/set-fields.c (n_frp, n_frp_allocated, complement_rp, set_fields): Prefer idx_t to ptrdiff_t/size_t for nonnegative sizes. (add_range_pair): Use xpalloc, not x2nrealloc.
2024-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * gnulib: Update included in this commit as copyright years are the only change from the previous gnulib commit. * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2023-11-14maint: DECIMAL_DIGIT_ACCUMULATE uses stdckdint.hPaul Eggert1-1/+1
* src/system.h: Include <stdckdint.h>, since the new DECIMAL_DIGIT_ACCUMULATE uses it. Do not include stdckdint.h from files that also include system.h. (DECIMAL_DIGIT_ACCUMULATE): Omit last arg, which is no longer needed. Reimplement by using C23-style stdckdint.h’s ckd_mul and ckd_add, as that’s more standard and is more likely to generate better code.
2023-10-30maint: include ctype.h selectivelyPaul Eggert1-0/+1
Include ctype.h only in files that need it. Many of its uses are incorrect, as they assume single-byte locales. The idea is to remove the incorrect uses later, when there is time. * src/chroot.c, src/csplit.c, src/dd.c, src/digest.c, src/dircolors.c: * src/expand-common.c, src/expand.c, src/fmt.c, src/fold.c, src/ls.c: * src/od.c, src/pinky.c, src/pr.c, src/ptx.c, src/seq.c: * src/set-fields.c, src/split.c, src/stdbuf.c, src/test.c: * src/tr.c, src/truncate.c, src/unexpand.c, src/wc.c: Include ctype.h. * src/system.h: Do not include ctype.h. include ctype.h.o
2023-07-01maint: go back to using ‘error’Paul Eggert1-1/+0
Now that Gnulib’s ‘error’ module does proper static checking for not returning, we need no longer use the ‘die’ macro. This makes code easier to read for people that are used to ‘error’. * cfg.mk (error_fns, exclude_file_name_regexp): Remove ‘die’. (sc_die_EXIT_FAILURE): Remove. * src/die.h: Remove. All includes removed. All calls to ‘die’ changed back to calls to ‘error’. * src/install.c (get_ids): Use quoteaf (problem found with make syntax-check). * src/system.h: Include error.h, since some of our macros call ‘error’. Stop including error.h elsewhere.
2023-06-29maint: prefer C23-style nullptrPaul Eggert1-1/+1
* bootstrap.conf (gnulib_modules): Add nullptr. In code, prefer nullptr to NULL where either will do.
2023-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
Update to latest gnulib with new copyright year. Run "make update-copyright" and then... * tests/init.sh: Sync with gnulib to pick up copyright year. * bootstrap: Manually update copyright year, until we fully sync with gnulib at a later stage. * tests/sample-test: Adjust to use the single most recent year.
2022-05-17maint: simplify comparisonsPaul Eggert1-4/+3
* src/comm.c (compare_files): * src/join.c (keycmp): * src/ls.c (off_cmp): * src/ptx.c (compare_words, compare_occurs): * src/set-fields.c (compare_ranges): Prefer ((a > b) - (a < b)) to variants like (a < b ? -1 : a > b) as it’s typically faster these days.
2022-01-31cut: simplify -fsanitize=leak pacificationPaul Eggert1-9/+0
* src/set-fields.c (reset_fields): Remove, as it’s not needed for -fsanitize=leak even when ‘lint’ is defined. All uses removed.
2022-01-02maint: update all copyright year number rangesPádraig Brady1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2021-12-18maint: use GNU style for spacingPaul Eggert1-4/+4
2021-07-26maint: fix white spacePaul Eggert1-12/+12
2021-06-11build: update gnulib submodule to latestPaul Eggert1-2/+1
Coreutils mistakenly did not list xstrndup as a module that it depends on directly. When the latest Gnulib removed the dirname module's dependency on xstrndup, this mistake caused coreutils to not build. Since all of Coreutils's uses of xstrndup know the string length, xmemdup0 is a better match for what's needed. Since the size args are typically signed or derived from subtracting pointers, the new Gnulib ximemdup0 function is a better match yet. So, use ximemdup0 instead of xstrndup. * src/cut.c, src/dircolors.c, src/expand-common.c, src/expand.c: * src/numfmt.c, src/set-fields.c, src/unexpand.c: Do not include xstrndup.h; no longer needed. * src/dircolors.c (parse_line): * src/expand-common.c (parse_tab_stops): * src/numfmt.c (parse_format_string): * src/set-fields.c (set_fields): Use ximemdup0 instead of xstrndup.
2021-04-11maint: use "char const *" rather than "const char *"Pádraig Brady1-1/+1
* cfg.mk (sc_prohibit-const-char): Add a new syntax-check to enforce this style. * *.[ch]: sed -i 's/const char \*/char const */g'
2021-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2020-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2019-01-01maint: update all copyright year number rangesAssaf Gordon1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2018-03-28cut: improve large file support on 32 bitTobias Stoeckmann1-17/+17
Increase max range from SIZE_MAX to UINTMAX_MAX, which will allow cut to support line lengths up to the max file size on all systems. The inherent SIZE_MAX limitation in cut was removed with the enhancements in https://bugs.gnu.org/13127. Also numfmt gets similarly increased --field ranges due to shared code. * src/cut.c: s/size_t/uintmax_t/. * src/numfmt.c: Likewise. * src/set-fields.c: Likewise. * src/set-fields.h: Likewise. * tests/misc/cut-huge-range.sh: Adjust accordingly. * tests/misc/numfmt.pl: Likewise. * NEWS: Mention the improvement.
2018-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2017-09-19all: prefer HTTPS in URLsPaul Eggert1-1/+1
2017-06-17maint: use C99 for loop initial declarations where possiblePádraig Brady1-4/+2
This results in a net reduction of about 120 lines.
2017-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2016-01-01maint: update all copyright year number rangesPádraig Brady1-1/+1
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. * tests/sample-test: Adjust to use the single most recent year.
2015-09-12cut: refactor into set-fields moduleAssaf Gordon1-0/+322
Extract the functionality of parsing --field=LIST into a separate module, to be used by other programs. * src/cut.c: move field parsing code from here ... * src/set-fields.{c,h}: ... to here. (set_fields): generalize by supporting multiple parsing/reporting options. (struct range_pair): rename to field_range_pair. * src/local.mk: link cut with set-field. * po/POTFILES.in: add set-field.c * tests/misc/cut.pl: update wording of error messages