maint: move field_sep into separate module

This is so that we don’t need to have every source file
include ctype.h.
* bootstrap.conf (gnulib_modules): Add cu-ctype.
* gl/lib/cu-ctype.c, gl/lib/cu-ctype.h, gl/modules/cu-ctype:
New files.
* src/join.c, src/numfmt.c, src/sort.c, src/uniq.c:
Include cu-ctype.h, for field_sep.
* src/system.h (field_sep): Remove; now supplied by cu-ctype.
This commit is contained in:
Paul Eggert committed 2023-10-30 00:58:04 -07:00
1 parent 2f3d9524bb
commit 684e810ae2
9 files changed
+67 -7

No files matched your search

+1
View File
@@ -70,6 +70,7 @@ gnulib_modules="
crypto/sha256
crypto/sha512
crypto/sm3
cu-ctype
cycle-check
d-ino
d-type
+3
View File
@@ -0,0 +1,3 @@
#include <config.h>
#define CU_CTYPE_INLINE _GL_EXTERN_INLINE
#include <cu-ctype.h>
+35
View File
@@ -0,0 +1,35 @@
/* Character type definitions for coreutils
Copyright 2023 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <ctype.h>
#ifndef _GL_INLINE_HEADER_BEGIN
# error "Please include config.h first."
#endif
_GL_INLINE_HEADER_BEGIN
#ifndef CU_CTYPE_INLINE
# define CU_CTYPE_INLINE _GL_INLINE
#endif
/* '\n' is considered a field separator with --zero-terminated. */
CU_CTYPE_INLINE bool
field_sep (unsigned char ch)
{
return isblank (ch) || ch == '\n';
}
_GL_INLINE_HEADER_END
+24
View File
@@ -0,0 +1,24 @@
Description:
ctype.h-like definitions for coreutils
Files:
lib/cu-ctype.c
lib/cu-ctype.h
Depends-on:
ctype
extern-inline
configure.ac:
Makefile.am:
lib_SOURCES += cu-ctype.c
Include:
"cu-ctype.h"
License:
GPL
Maintainer:
all
+1
View File
@@ -23,6 +23,7 @@
#include "system.h"
#include "assure.h"
#include "cu-ctype.h"
#include "fadvise.h"
#include "hard-locale.h"
#include "linebuffer.h"
+1
View File
@@ -24,6 +24,7 @@
#include "argmatch.h"
#include "c-ctype.h"
#include "cu-ctype.h"
#include "mbswidth.h"
#include "quote.h"
#include "system.h"
+1
View File
@@ -31,6 +31,7 @@
#include "system.h"
#include "argmatch.h"
#include "assure.h"
#include "cu-ctype.h"
#include "fadvise.h"
#include "filevercmp.h"
#include "flexmember.h"
-7
View File
@@ -158,13 +158,6 @@ enum
errors that the cast doesn't. */
static inline unsigned char to_uchar (char ch) { return ch; }
/* '\n' is considered a field separator with --zero-terminated. */
static inline bool
field_sep (unsigned char ch)
{
return isblank (ch) || ch == '\n';
}
#include <locale.h>
/* Take care of NLS matters. */
+1
View File
@@ -23,6 +23,7 @@
#include "system.h"
#include "argmatch.h"
#include "cu-ctype.h"
#include "linebuffer.h"
#include "fadvise.h"
#include "posixver.h"