Bash-5.3-alpha release

This commit is contained in:
Chet Ramey
2024-04-22 10:33:38 -04:00
parent f3b6bd1945
commit 622d318652
700 changed files with 136534 additions and 96420 deletions
+24 -45
View File
@@ -1,6 +1,6 @@
/* stringlist.c - functions to handle a generic `list of strings' structure */
/* Copyright (C) 2000-2019 Free Software Foundation, Inc.
/* Copyright (C) 2000-2019, 2022-2023 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
@@ -37,11 +37,10 @@
/* Allocate a new STRINGLIST, with room for N strings. */
STRINGLIST *
strlist_create (n)
int n;
strlist_create (size_t n)
{
STRINGLIST *ret;
register int i;
int i;
ret = (STRINGLIST *)xmalloc (sizeof (STRINGLIST));
if (n)
@@ -61,11 +60,9 @@ strlist_create (n)
}
STRINGLIST *
strlist_resize (sl, n)
STRINGLIST *sl;
int n;
strlist_resize (STRINGLIST *sl, size_t n)
{
register int i;
size_t i;
if (sl == 0)
return (sl = strlist_create (n));
@@ -81,8 +78,7 @@ strlist_resize (sl, n)
}
void
strlist_flush (sl)
STRINGLIST *sl;
strlist_flush (STRINGLIST *sl)
{
if (sl == 0 || sl->list == 0)
return;
@@ -91,8 +87,7 @@ strlist_flush (sl)
}
void
strlist_dispose (sl)
STRINGLIST *sl;
strlist_dispose (STRINGLIST *sl)
{
if (sl == 0)
return;
@@ -102,9 +97,7 @@ strlist_dispose (sl)
}
int
strlist_remove (sl, s)
STRINGLIST *sl;
char *s;
strlist_remove (STRINGLIST *sl, const char *s)
{
int r;
@@ -118,11 +111,10 @@ strlist_remove (sl, s)
}
STRINGLIST *
strlist_copy (sl)
STRINGLIST *sl;
strlist_copy (STRINGLIST *sl)
{
STRINGLIST *new;
register int i;
int i;
if (sl == 0)
return ((STRINGLIST *)0);
@@ -144,11 +136,10 @@ strlist_copy (sl)
/* Return a new STRINGLIST with everything from M1 and M2. */
STRINGLIST *
strlist_merge (m1, m2)
STRINGLIST *m1, *m2;
strlist_merge (STRINGLIST *m1, STRINGLIST *m2)
{
STRINGLIST *sl;
int i, n, l1, l2;
size_t i, n, l1, l2;
l1 = m1 ? m1->list_len : 0;
l2 = m2 ? m2->list_len : 0;
@@ -165,10 +156,9 @@ strlist_merge (m1, m2)
/* Make STRINGLIST M1 contain everything in M1 and M2. */
STRINGLIST *
strlist_append (m1, m2)
STRINGLIST *m1, *m2;
strlist_append (STRINGLIST *m1, STRINGLIST *m2)
{
register int i, n, len1, len2;
size_t i, n, len1, len2;
if (m1 == 0)
return (m2 ? strlist_copy (m2) : (STRINGLIST *)0);
@@ -189,11 +179,9 @@ strlist_append (m1, m2)
}
STRINGLIST *
strlist_prefix_suffix (sl, prefix, suffix)
STRINGLIST *sl;
char *prefix, *suffix;
strlist_prefix_suffix (STRINGLIST *sl, const char *prefix, const char *suffix)
{
int plen, slen, tlen, llen, i;
size_t plen, slen, tlen, llen, i;
char *t;
if (sl == 0 || sl->list == 0 || sl->list_len == 0)
@@ -223,11 +211,9 @@ strlist_prefix_suffix (sl, prefix, suffix)
}
void
strlist_print (sl, prefix)
STRINGLIST *sl;
char *prefix;
strlist_print (STRINGLIST *sl, const char *prefix)
{
register int i;
int i;
if (sl == 0)
return;
@@ -236,11 +222,9 @@ strlist_print (sl, prefix)
}
void
strlist_walk (sl, func)
STRINGLIST *sl;
sh_strlist_map_func_t *func;
strlist_walk (STRINGLIST *sl, sh_strlist_map_func_t *func)
{
register int i;
int i;
if (sl == 0)
return;
@@ -250,8 +234,7 @@ strlist_walk (sl, func)
}
void
strlist_sort (sl)
STRINGLIST *sl;
strlist_sort (STRINGLIST *sl)
{
if (sl == 0 || sl->list_len == 0 || sl->list == 0)
return;
@@ -259,9 +242,7 @@ strlist_sort (sl)
}
STRINGLIST *
strlist_from_word_list (list, alloc, starting_index, ip)
WORD_LIST *list;
int alloc, starting_index, *ip;
strlist_from_word_list (WORD_LIST *list, int alloc, int starting_index, int *ip)
{
STRINGLIST *ret;
int slen, len;
@@ -272,7 +253,7 @@ strlist_from_word_list (list, alloc, starting_index, 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;
@@ -283,9 +264,7 @@ strlist_from_word_list (list, alloc, starting_index, ip)
}
WORD_LIST *
strlist_to_word_list (sl, alloc, starting_index)
STRINGLIST *sl;
int alloc, starting_index;
strlist_to_word_list (STRINGLIST *sl, int alloc, int starting_index)
{
WORD_LIST *list;