mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 23:53:18 +02:00
commit bash-20161007 snapshot
This commit is contained in:
@@ -11907,3 +11907,48 @@ subst.c
|
||||
calls. Adds command substitution inside other parse_and_execute
|
||||
calls optimizations to suppress forks, as suggested by
|
||||
Martijn Dekker <martijn@inlv.org>
|
||||
|
||||
10/3
|
||||
----
|
||||
configure.ac
|
||||
- SHOBJ_STATUS: make sure it defaults to unsupported and is substituted
|
||||
if the shobj-conf script isn't run. Fixes `make install' bug with
|
||||
a minimal config reported by Andrew Tomazos <andrewtomazos@gmail.com>
|
||||
|
||||
10/5
|
||||
----
|
||||
support/shobj-conf
|
||||
- darwin: set compatibility_version for a shared build of the readline
|
||||
library (the standalone readline distribution shares this file) to
|
||||
$(SHLIB_MAJOR)$(SHLIB_MINOR). Recommendation from Max Horn
|
||||
<max@quendi.de>
|
||||
|
||||
10/6
|
||||
----
|
||||
array.h
|
||||
- array_first_index: new convenience define
|
||||
|
||||
array.c
|
||||
- ADD_AFTER: new define, complement of ADD_BEFORE
|
||||
- UNSET_LASTREF: now takes an array as an argument, prepping for move
|
||||
of lastref pointer into the array struct
|
||||
- array_insert: check whether we are adding at the beginning of the
|
||||
array and take a fast path if so
|
||||
- array_insert: use same strategy as array_reference to find the place
|
||||
to insert, starting from the last-referenced element and moving
|
||||
forward or back from there; use ADD_AFTER if moving backward
|
||||
- array_insert: if replacing an existing element, just replace the
|
||||
value with new->value instead of the entire element
|
||||
- array_reference: short-circuit quickly if looking for an element
|
||||
before the first assigned index
|
||||
- array_reference: if we don't find the element, leave lastref pointing
|
||||
to the closest element under the assumption we will be assigning or
|
||||
looking for something close
|
||||
- array_reference: take advantage of ordered indexes to short-circuit
|
||||
when looking for element that is not set
|
||||
|
||||
10/7
|
||||
----
|
||||
array.c
|
||||
- array_remove: short-circuit if asked to remove index after max
|
||||
index or before first index
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* chet@ins.cwru.edu
|
||||
*/
|
||||
|
||||
/* Copyright (C) 1997-2009 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -52,6 +52,14 @@
|
||||
ae->prev = new; \
|
||||
new->next = ae; \
|
||||
} while(0)
|
||||
|
||||
#define ADD_AFTER(ae, new) \
|
||||
do { \
|
||||
ae->next->prev = new; \
|
||||
new->next = ae->next; \
|
||||
new->prev = ae; \
|
||||
ae->next = new; \
|
||||
} while (0)
|
||||
|
||||
static char *array_to_string_internal __P((ARRAY_ELEMENT *, ARRAY_ELEMENT *, char *, int));
|
||||
|
||||
@@ -83,7 +91,7 @@ do { \
|
||||
lastref = (e); \
|
||||
} while (0)
|
||||
|
||||
#define UNSET_LASTREF() \
|
||||
#define UNSET_LASTREF(a) \
|
||||
do { \
|
||||
lastarray = 0; \
|
||||
lastref = 0; \
|
||||
@@ -95,7 +103,7 @@ array_create()
|
||||
ARRAY *r;
|
||||
ARRAY_ELEMENT *head;
|
||||
|
||||
r =(ARRAY *)xmalloc(sizeof(ARRAY));
|
||||
r = (ARRAY *)xmalloc(sizeof(ARRAY));
|
||||
r->type = array_indexed;
|
||||
r->max_index = -1;
|
||||
r->num_elements = 0;
|
||||
@@ -620,6 +628,8 @@ arrayind_t i;
|
||||
char *v;
|
||||
{
|
||||
register ARRAY_ELEMENT *new, *ae, *start;
|
||||
arrayind_t startind;
|
||||
int direction;
|
||||
|
||||
if (a == 0)
|
||||
return(-1);
|
||||
@@ -635,6 +645,12 @@ char *v;
|
||||
a->num_elements++;
|
||||
SET_LASTREF(a, new);
|
||||
return(0);
|
||||
} else if (i < array_first_index(a)) {
|
||||
/* Hook at the beginning */
|
||||
ADD_AFTER(a->head, new);
|
||||
a->num_elements++;
|
||||
SET_LASTREF(a, new);
|
||||
return(0);
|
||||
}
|
||||
#if OPTIMIZE_SEQUENTIAL_ARRAY_ASSIGNMENT
|
||||
/*
|
||||
@@ -642,26 +658,48 @@ char *v;
|
||||
* handle optimizes the case of sequential or almost-sequential
|
||||
* assignments that are not at the end of the array.
|
||||
*/
|
||||
start = LASTREF_START(a, i);
|
||||
start = LASTREF(a);
|
||||
/* Use same strategy as array_reference to avoid paying large penalty
|
||||
for semi-random assignment pattern. */
|
||||
startind = element_index(start);
|
||||
if (i < startind/2) {
|
||||
start = element_forw(a->head);
|
||||
startind = element_index(start);
|
||||
direction = 1;
|
||||
} else if (i >= startind) {
|
||||
direction = 1;
|
||||
} else {
|
||||
direction = -1;
|
||||
}
|
||||
#else
|
||||
start = element_forw(ae->head);
|
||||
startind = element_index(start);
|
||||
direction = 1;
|
||||
#endif
|
||||
for (ae = start; ae != a->head; ae = element_forw(ae)) {
|
||||
for (ae = start; ae != a->head; ) {
|
||||
if (element_index(ae) == i) {
|
||||
/*
|
||||
* Replacing an existing element.
|
||||
*/
|
||||
array_dispose_element(new);
|
||||
free(element_value(ae));
|
||||
ae->value = v ? savestring(v) : (char *)NULL;
|
||||
/* Just swap in the new value */
|
||||
ae->value = new->value;
|
||||
new->value = 0;
|
||||
array_dispose_element(new);
|
||||
SET_LASTREF(a, ae);
|
||||
return(0);
|
||||
} else if (element_index(ae) > i) {
|
||||
} else if (direction == 1 && element_index(ae) > i) {
|
||||
ADD_BEFORE(ae, new);
|
||||
a->num_elements++;
|
||||
SET_LASTREF(a, new);
|
||||
return(0);
|
||||
} else if (direction == -1 && element_index(ae) < i) {
|
||||
ADD_AFTER(ae, new);
|
||||
a->num_elements++;
|
||||
SET_LASTREF(a, new);
|
||||
return(0);
|
||||
}
|
||||
ae = direction == 1 ? element_forw(ae) : element_back(ae);
|
||||
}
|
||||
array_dispose_element(new);
|
||||
INVALIDATE_LASTREF(a);
|
||||
@@ -678,11 +716,27 @@ ARRAY *a;
|
||||
arrayind_t i;
|
||||
{
|
||||
register ARRAY_ELEMENT *ae, *start;
|
||||
arrayind_t startind;
|
||||
int direction;
|
||||
|
||||
if (a == 0 || array_empty(a))
|
||||
return((ARRAY_ELEMENT *) NULL);
|
||||
start = LASTREF_START(a, i);
|
||||
for (ae = start; ae != a->head; ae = element_forw(ae))
|
||||
if (i > array_max_index(a) || i < array_first_index(a))
|
||||
return((char *)NULL); /* Keep roving pointer into array to optimize sequential access */
|
||||
start = LASTREF(a);
|
||||
/* Use same strategy as array_reference to avoid paying large penalty
|
||||
for semi-random assignment pattern. */
|
||||
startind = element_index(start);
|
||||
if (i < startind/2) {
|
||||
start = element_forw(a->head);
|
||||
startind = element_index(start);
|
||||
direction = 1;
|
||||
} else if (i >= startind) {
|
||||
direction = 1;
|
||||
} else {
|
||||
direction = -1;
|
||||
}
|
||||
for (ae = start; ae != a->head; ) {
|
||||
if (element_index(ae) == i) {
|
||||
ae->next->prev = ae->prev;
|
||||
ae->prev->next = ae->next;
|
||||
@@ -701,6 +755,12 @@ arrayind_t i;
|
||||
#endif
|
||||
return(ae);
|
||||
}
|
||||
ae = (direction == 1) ? element_forw(ae) : element_back(ae);
|
||||
if (direction == 1 && element_index(ae) > i)
|
||||
break;
|
||||
else if (direction == -1 && element_index(ae) < i)
|
||||
break;
|
||||
}
|
||||
return((ARRAY_ELEMENT *) NULL);
|
||||
}
|
||||
|
||||
@@ -718,7 +778,7 @@ arrayind_t i;
|
||||
|
||||
if (a == 0 || array_empty(a))
|
||||
return((char *) NULL);
|
||||
if (i > array_max_index(a))
|
||||
if (i > array_max_index(a) || i < array_first_index(a))
|
||||
return((char *)NULL); /* Keep roving pointer into array to optimize sequential access */
|
||||
start = LASTREF(a); /* lastref pointer */
|
||||
startind = element_index(start);
|
||||
@@ -737,8 +797,24 @@ arrayind_t i;
|
||||
return(element_value(ae));
|
||||
}
|
||||
ae = (direction == 1) ? element_forw(ae) : element_back(ae);
|
||||
/* Take advantage of index ordering to short-circuit */
|
||||
/* If we don't find it, set the lastref pointer to the element
|
||||
that's `closest', assuming that the unsuccessful reference
|
||||
will quickly be followed by an assignment. No worse than
|
||||
not changing it from the previous value or resetting it. */
|
||||
if (direction == 1 && element_index(ae) > i) {
|
||||
start = ae; /* use for SET_LASTREF below */
|
||||
break;
|
||||
} else if (direction == -1 && element_index(ae) < i) {
|
||||
start = ae; /* use for SET_LASTREF below */
|
||||
break;
|
||||
}
|
||||
}
|
||||
UNSET_LASTREF(); /* XXX SET_LASTREF(a, start) ? */
|
||||
#if 0
|
||||
UNSET_LASTREF(a);
|
||||
#else
|
||||
SET_LASTREF(a, start);
|
||||
#endif
|
||||
return((char *) NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ extern ARRAY *array_from_string __P((char *, char *));
|
||||
|
||||
#define array_num_elements(a) ((a)->num_elements)
|
||||
#define array_max_index(a) ((a)->max_index)
|
||||
#define array_first_index(a) ((a)->head->next->ind)
|
||||
#define array_head(a) ((a)->head)
|
||||
#define array_empty(a) ((a)->num_elements == 0)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac for Bash 4.4, version 4.082.
|
||||
# From configure.ac for Bash 4.4, version 4.083.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.69 for bash 4.4-maint.
|
||||
#
|
||||
@@ -16124,6 +16124,9 @@ $as_echo_n "checking shared object configuration for loadable builtins... " >&6;
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHOBJ_STATUS" >&5
|
||||
$as_echo "$SHOBJ_STATUS" >&6; }
|
||||
else
|
||||
SHOBJ_STATUS=unsupported
|
||||
|
||||
fi
|
||||
|
||||
# try to create a directory tree if the source is elsewhere
|
||||
|
||||
+4
-1
@@ -21,7 +21,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 4.4, version 4.082])dnl
|
||||
AC_REVISION([for Bash 4.4, version 4.083])dnl
|
||||
|
||||
define(bashvers, 4.4)
|
||||
define(relstatus, maint)
|
||||
@@ -1151,6 +1151,9 @@ then
|
||||
AC_SUBST(SHOBJ_LIBS)
|
||||
AC_SUBST(SHOBJ_STATUS)
|
||||
AC_MSG_RESULT($SHOBJ_STATUS)
|
||||
else
|
||||
SHOBJ_STATUS=unsupported
|
||||
AC_SUBST(SHOBJ_STATUS)
|
||||
fi
|
||||
|
||||
# try to create a directory tree if the source is elsewhere
|
||||
|
||||
+851
-1111
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -189,7 +189,7 @@ darwin*)
|
||||
darwin[1-7].*)
|
||||
SHOBJ_STATUS=unsupported
|
||||
SHOBJ_LDFLAGS='-dynamic'
|
||||
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
SHLIB_XLDFLAGS='-arch_only `/usr/bin/arch` -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -v'
|
||||
;;
|
||||
# Darwin 8 == Mac OS X 10.4; Mac OS X 10.N == Darwin N+4
|
||||
*)
|
||||
@@ -205,7 +205,7 @@ darwin*)
|
||||
;;
|
||||
esac
|
||||
SHOBJ_LDFLAGS="-dynamiclib -dynamic -undefined dynamic_lookup ${SHOBJ_ARCHFLAGS}"
|
||||
SHLIB_XLDFLAGS="-dynamiclib ${SHOBJ_ARCHFLAGS}"' -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR) -v'
|
||||
SHLIB_XLDFLAGS="-dynamiclib ${SHOBJ_ARCHFLAGS}"' -install_name $(libdir)/`echo $@ | sed "s:\\..*::"`.$(SHLIB_MAJOR).$(SHLIB_LIBSUFF) -current_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -compatibility_version $(SHLIB_MAJOR)$(SHLIB_MINOR) -v'
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user