Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fixes in params.c
- X-seq: zsh-workers 5560
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: fixes in params.c
- Date: Mon, 1 Mar 1999 10:17:48 +0100 (MET)
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
This fixes two problems in the parameter code:
- The [iIrR] subscript flags didn't work for scalars any more.
- The function getstrvalue() used a static local buffer to convert an
integer to a string and returned a pointer to that buffer. This
works fine unless one has a special hash parameter with integer
sub-parameters. With that, trying to get all values of the hash will
give you the same value for all integers. The patch makes the buffer
be copied.
Bye
Sven
--- oos/params.c Mon Mar 1 10:06:00 1999
+++ Src/params.c Mon Mar 1 10:13:01 1999
@@ -767,14 +767,15 @@
else if (v->isarr & SCANPM_WANTVALS)
*inv = 0;
else {
- if (ind) {
- v->isarr |= SCANPM_WANTKEYS;
- v->isarr &= ~SCANPM_WANTVALS;
- } else if (rev) {
- v->isarr |= SCANPM_WANTVALS;
+ if (v->isarr) {
+ if (ind) {
+ v->isarr |= SCANPM_WANTKEYS;
+ v->isarr &= ~SCANPM_WANTVALS;
+ } else if (rev)
+ v->isarr |= SCANPM_WANTVALS;
+ if (!down && ishash)
+ v->isarr &= ~SCANPM_MATCHMANY;
}
- if (!down && ishash)
- v->isarr &= ~SCANPM_MATCHMANY;
*inv = ind;
}
@@ -1177,7 +1178,8 @@
}
LASTALLOC_RETURN s;
case PM_INTEGER:
- convbase(s = buf, v->pm->gets.ifn(v->pm), v->pm->ct);
+ convbase(buf, v->pm->gets.ifn(v->pm), v->pm->ct);
+ s = dupstring(buf);
break;
case PM_SCALAR:
s = v->pm->gets.cfn(v->pm);
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author