* PATCH: fixes in params.c
@ 1999-03-01 9:17 Sven Wischnowsky
0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 1999-03-01 9:17 UTC (permalink / raw)
To: zsh-workers
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@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-03-01 9:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-01 9:17 PATCH: fixes in params.c Sven Wischnowsky
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).