summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2013-11-10 19:25:56 +0100
committerUlrich Müller <ulm@gentoo.org>2013-11-10 19:25:56 +0100
commit26c49888ff5c503a1149719f87cb3f4a3f941a50 (patch)
tree6663de1d3425a45f1f52d381716eb7836f34e859
parentCosmetic changes in output.bash. (diff)
downloadeselect-26c49888ff5c503a1149719f87cb3f4a3f941a50.tar.gz
eselect-26c49888ff5c503a1149719f87cb3f4a3f941a50.tar.bz2
eselect-26c49888ff5c503a1149719f87cb3f4a3f941a50.zip
Implement space function more efficiently.
* libs/output.bash.in (space): Implement more efficiently.
-rw-r--r--ChangeLog4
-rw-r--r--libs/output.bash.in7
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 0aad0e4..31418dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-11-10 Ulrich Müller <ulm@gentoo.org>
+
+ * libs/output.bash.in (space): Implement more efficiently.
+
2013-10-27 Ulrich Müller <ulm@gentoo.org>
* autogen.bash: Update for aclocal 1.14.
diff --git a/libs/output.bash.in b/libs/output.bash.in
index ac934bb..78e0c4f 100644
--- a/libs/output.bash.in
+++ b/libs/output.bash.in
@@ -242,9 +242,8 @@ highlight_marker() {
# space PUBLIC
# Write $1 numbers of spaces
space() {
- local n ret=""
- for (( n = 1; n <= $1; ++n )); do
- ret="${ret} "
+ local n=$1
+ while (( n-- > 0 )); do
+ echo -n " "
done
- echo -n "${ret}"
}