mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 04:30:44 +02:00
more ANSI/ISO C cleanups
This commit is contained in:
+1
-5
@@ -1,7 +1,7 @@
|
||||
/* collsyms.h -- collating symbol names and their corresponding characters
|
||||
(in ascii) as given by POSIX.2 in table 2.8. */
|
||||
|
||||
/* Copyright (C) 1997-2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997-2002,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -38,11 +38,7 @@ static __COLLSYM POSIXCOLL [] =
|
||||
{ L("EOT"), L('\004') },
|
||||
{ L("ENQ"), L('\005') },
|
||||
{ L("ACK"), L('\006') },
|
||||
#ifdef __STDC__
|
||||
{ L("alert"), L('\a') },
|
||||
#else
|
||||
{ L("alert"), L('\007') },
|
||||
#endif
|
||||
{ L("BS"), L('\010') },
|
||||
{ L("backspace"), L('\b') },
|
||||
{ L("HT"), L('\011') },
|
||||
|
||||
@@ -60,14 +60,6 @@
|
||||
# define bcopy(s, d, n) ((void) memcpy ((d), (s), (n)))
|
||||
#endif /* !HAVE_BCOPY && !bcopy */
|
||||
|
||||
#if !defined (NULL)
|
||||
# if defined (__STDC__)
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0x0
|
||||
# endif /* __STDC__ */
|
||||
#endif /* !NULL */
|
||||
|
||||
#if !defined (FREE)
|
||||
# define FREE(x) if (x) free (x)
|
||||
#endif
|
||||
|
||||
@@ -36,11 +36,7 @@ extern "C" {
|
||||
# include <readline/rltypedefs.h>
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
typedef void *histdata_t;
|
||||
#else
|
||||
typedef char *histdata_t;
|
||||
#endif
|
||||
|
||||
/* Let's not step on anyone else's define for now, since we don't use this yet. */
|
||||
#ifndef HS_HISTORY_VERSION
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* xmalloc.h -- memory allocation that aborts on errors. */
|
||||
|
||||
/* Copyright (C) 1999-2009,2010-2021 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1999-2009,2010-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU Readline Library (Readline), a library
|
||||
for reading lines of text with interactive input and history editing.
|
||||
@@ -29,13 +29,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef PTR_T
|
||||
|
||||
#ifdef __STDC__
|
||||
# define PTR_T void *
|
||||
#else
|
||||
# define PTR_T char *
|
||||
#endif
|
||||
|
||||
# define PTR_T void *
|
||||
#endif /* !PTR_T */
|
||||
|
||||
extern PTR_T xmalloc (size_t);
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ strlist_from_word_list (WORD_LIST *list, int alloc, int starting_index, int *ip)
|
||||
*ip = 0;
|
||||
return ((STRINGLIST *)0);
|
||||
}
|
||||
slen = list_length (list);
|
||||
slen = list_length ((GENERIC_LIST *)list);
|
||||
ret = (STRINGLIST *)xmalloc (sizeof (STRINGLIST));
|
||||
ret->list = strvec_from_word_list (list, alloc, starting_index, &len);
|
||||
ret->list_size = slen + starting_index;
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ strvec_from_word_list (WORD_LIST *list, int alloc, int starting_index, int *ip)
|
||||
int count;
|
||||
char **array;
|
||||
|
||||
count = list_length (list);
|
||||
count = list_length ((GENERIC_LIST *)list);
|
||||
array = (char **)xmalloc ((1 + count + starting_index) * sizeof (char *));
|
||||
|
||||
for (count = 0; count < starting_index; count++)
|
||||
|
||||
@@ -95,13 +95,8 @@ ansicstr (const char *string, size_t len, int flags, int *sawc, size_t *rlen)
|
||||
{
|
||||
switch (c = *s++)
|
||||
{
|
||||
#if defined (__STDC__)
|
||||
case 'a': c = '\a'; break;
|
||||
case 'v': c = '\v'; break;
|
||||
#else
|
||||
case 'a': c = (int) 0x07; break;
|
||||
case 'v': c = (int) 0x0B; break;
|
||||
#endif
|
||||
case 'b': c = '\b'; break;
|
||||
case 'e': case 'E': /* ESC -- non-ANSI */
|
||||
c = ESC; break;
|
||||
@@ -257,14 +252,8 @@ ansic_quote (const char *str, int flags, int *rlen)
|
||||
switch (c)
|
||||
{
|
||||
case ESC: c = 'E'; break;
|
||||
#ifdef __STDC__
|
||||
case '\a': c = 'a'; break;
|
||||
case '\v': c = 'v'; break;
|
||||
#else
|
||||
case 0x07: c = 'a'; break;
|
||||
case 0x0b: c = 'v'; break;
|
||||
#endif
|
||||
|
||||
case '\b': c = 'b'; break;
|
||||
case '\f': c = 'f'; break;
|
||||
case '\n': c = 'n'; break;
|
||||
|
||||
@@ -68,14 +68,6 @@ extern struct passwd *getpwnam (const char *);
|
||||
#define savestring(x) strcpy ((char *)xmalloc (1 + strlen (x)), (x))
|
||||
#endif /* !savestring */
|
||||
|
||||
#if !defined (NULL)
|
||||
# if defined (__STDC__)
|
||||
# define NULL ((void *) 0)
|
||||
# else
|
||||
# define NULL 0x0
|
||||
# endif /* !__STDC__ */
|
||||
#endif /* !NULL */
|
||||
|
||||
/* If being compiled as part of bash, these will be satisfied from
|
||||
variables.o. If being compiled as part of readline, they will
|
||||
be satisfied from shell.o. */
|
||||
|
||||
Reference in New Issue
Block a user