zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: fixes in params.c
Date: Mon, 1 Mar 1999 10:17:48 +0100 (MET)	[thread overview]
Message-ID: <199903010917.KAA08918@beta.informatik.hu-berlin.de> (raw)


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


                 reply	other threads:[~1999-03-01  9:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199903010917.KAA08918@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).