mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-27 18:05:02 +00:00
maint: assume STDC_HEADERS
We don’t need to worry about pre-C89 any more. * src/common.h (CTYPE_DOMAIN, ISSPACE): Remove. All uses of ISSPACE replaced by isspace. (errno): Remove decl.
This commit is contained in:
parent
5b8ecde1a2
commit
4887683ab0
14
src/common.h
14
src/common.h
@ -42,16 +42,6 @@
|
||||
#include <intprops.h>
|
||||
|
||||
#include <ctype.h>
|
||||
/* CTYPE_DOMAIN (C) is nonzero if the unsigned char C can safely be given
|
||||
as an argument to <ctype.h> macros like 'isspace'. */
|
||||
#if STDC_HEADERS
|
||||
#define CTYPE_DOMAIN(c) 1
|
||||
#else
|
||||
#define CTYPE_DOMAIN(c) ((unsigned) (c) <= 0177)
|
||||
#endif
|
||||
#ifndef ISSPACE
|
||||
#define ISSPACE(c) (CTYPE_DOMAIN (c) && isspace (c))
|
||||
#endif
|
||||
|
||||
#ifndef ISDIGIT
|
||||
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
|
||||
@ -149,10 +139,6 @@ XTERN char *revision; /* prerequisite revision, if any */
|
||||
void fatal_exit (int) __attribute__ ((noreturn));
|
||||
|
||||
#include <errno.h>
|
||||
#if !STDC_HEADERS && !defined errno
|
||||
extern int errno;
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -323,8 +323,8 @@ plan_a (char const *filename)
|
||||
|
||||
for (s = buffer; (s = (char *) memchr (s, rev0, limrev - s)); s++)
|
||||
if (memcmp (s, rev, revlen) == 0
|
||||
&& (s == buffer || ISSPACE ((unsigned char) s[-1]))
|
||||
&& (s + 1 == limrev || ISSPACE ((unsigned char) s[revlen])))
|
||||
&& (s == buffer || isspace ((unsigned char) s[-1]))
|
||||
&& (s + 1 == limrev || isspace ((unsigned char) s[revlen])))
|
||||
{
|
||||
found_revision = true;
|
||||
break;
|
||||
@ -402,13 +402,13 @@ plan_b (char const *filename)
|
||||
{
|
||||
if (i == revlen)
|
||||
{
|
||||
found_revision = ISSPACE ((unsigned char) c);
|
||||
found_revision = isspace ((unsigned char) c);
|
||||
i = (size_t) -1;
|
||||
}
|
||||
else if (i != (size_t) -1)
|
||||
i = rev[i]==c ? i + 1 : (size_t) -1;
|
||||
|
||||
if (i == (size_t) -1 && ISSPACE ((unsigned char) c))
|
||||
if (i == (size_t) -1 && isspace ((unsigned char) c))
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
12
src/pch.c
12
src/pch.c
@ -328,7 +328,7 @@ fetchmode (char const *str)
|
||||
const char *s;
|
||||
mode_t mode;
|
||||
|
||||
while (ISSPACE ((unsigned char) *str))
|
||||
while (isspace ((unsigned char) *str))
|
||||
str++;
|
||||
|
||||
for (s = str, mode = 0; s < str + 6; s++)
|
||||
@ -570,14 +570,14 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
|
||||
}
|
||||
else if (strnEQ(s, "Prereq:", 7))
|
||||
{
|
||||
for (t = s + 7; ISSPACE ((unsigned char) *t); t++)
|
||||
for (t = s + 7; isspace ((unsigned char) *t); t++)
|
||||
/* do nothing */ ;
|
||||
revision = t;
|
||||
for (t = revision; *t; t++)
|
||||
if (ISSPACE ((unsigned char) *t))
|
||||
if (isspace ((unsigned char) *t))
|
||||
{
|
||||
char const *u;
|
||||
for (u = t + 1; ISSPACE ((unsigned char) *u); u++)
|
||||
for (u = t + 1; isspace ((unsigned char) *u); u++)
|
||||
/* do nothing */ ;
|
||||
if (*u)
|
||||
{
|
||||
@ -615,7 +615,7 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
|
||||
p_name[i] = 0;
|
||||
}
|
||||
if (! ((p_name[OLD] = parse_name (s + 11, strippath, &u))
|
||||
&& ISSPACE ((unsigned char) *u)
|
||||
&& isspace ((unsigned char) *u)
|
||||
&& (p_name[NEW] = parse_name (u, strippath, &u))
|
||||
&& (u = skip_spaces (u), ! *u)))
|
||||
for (i = OLD; i <= NEW; i++)
|
||||
@ -632,7 +632,7 @@ intuit_diff_type (bool need_header, mode_t *p_file_type)
|
||||
if ((u = skip_hex_digits (s + 6))
|
||||
&& u[0] == '.' && u[1] == '.'
|
||||
&& (v = skip_hex_digits (u + 2))
|
||||
&& (! *v || ISSPACE ((unsigned char) *v)))
|
||||
&& (! *v || isspace ((unsigned char) *v)))
|
||||
{
|
||||
get_sha1(&p_sha1[OLD], s + 6, u);
|
||||
get_sha1(&p_sha1[NEW], u + 2, v);
|
||||
|
||||
10
src/util.c
10
src/util.c
@ -1464,7 +1464,7 @@ fetchname (char const *at, int strip_leading, char **pname,
|
||||
stamp.tv_sec = -1;
|
||||
stamp.tv_nsec = 0;
|
||||
|
||||
while (ISSPACE ((unsigned char) *at))
|
||||
while (isspace ((unsigned char) *at))
|
||||
at++;
|
||||
if (debug & 128)
|
||||
say ("fetchname %s %d\n", at, strip_leading);
|
||||
@ -1483,12 +1483,12 @@ fetchname (char const *at, int strip_leading, char **pname,
|
||||
{
|
||||
for (t = at; *t; t++)
|
||||
{
|
||||
if (ISSPACE ((unsigned char) *t))
|
||||
if (isspace ((unsigned char) *t))
|
||||
{
|
||||
/* Allow file names with internal spaces,
|
||||
but only if a tab separates the file name from the date. */
|
||||
char const *u = t;
|
||||
while (*u != '\t' && ISSPACE ((unsigned char) u[1]))
|
||||
while (*u != '\t' && isspace ((unsigned char) u[1]))
|
||||
u++;
|
||||
if (*u != '\t' && (strchr (u + 1, pstamp ? '\t' : '\n')))
|
||||
continue;
|
||||
@ -1575,7 +1575,7 @@ parse_name (char const *s, int strip_leading, char const **endp)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
while (ISSPACE ((unsigned char) *s))
|
||||
while (isspace ((unsigned char) *s))
|
||||
s++;
|
||||
if (*s == '"')
|
||||
{
|
||||
@ -1587,7 +1587,7 @@ parse_name (char const *s, int strip_leading, char const **endp)
|
||||
{
|
||||
char const *t;
|
||||
|
||||
for (t = s; *t && ! ISSPACE ((unsigned char) *t); t++)
|
||||
for (t = s; *t && ! isspace ((unsigned char) *t); t++)
|
||||
/* do nothing*/ ;
|
||||
ret = xmemdup0 (s, t - s);
|
||||
if (endp)
|
||||
|
||||
@ -84,7 +84,7 @@ void set_file_attributes (char const *, enum file_attributes, char const *,
|
||||
static inline char const * _GL_ATTRIBUTE_PURE
|
||||
skip_spaces (char const *str)
|
||||
{
|
||||
while (ISSPACE ((unsigned char) *str))
|
||||
while (isspace ((unsigned char) *str))
|
||||
str++;
|
||||
return str;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user