From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27023 invoked from network); 16 Jan 1999 01:05:32 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Jan 1999 01:05:32 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id UAA23182; Fri, 15 Jan 1999 20:04:40 -0500 (EST) Resent-Date: Fri, 15 Jan 1999 20:04:40 -0500 (EST) From: "Bart Schaefer" Message-Id: <990115170349.ZM28259@candle.brasslantern.com> Date: Fri, 15 Jan 1999 17:03:49 -0800 In-Reply-To: Comments: In reply to "Daniel X. Pape" "try(X) in exec.c ?" (Jan 15, 12:21pm) References: X-Mailer: Z-Mail (4.0b.820 20aug96) To: "Daniel X. Pape" , zsh-workers@math.gatech.edu Subject: Re: try(X) in exec.c ? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"V9OdO2.0.6g5.eM-ds"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/4922 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Jan 15, 12:21pm, Daniel X. Pape wrote: } Subject: try(X) in exec.c ? } } I wanted to ask if someone could tell me what the purpose of the return } value of the macro try(X) in exec. is? (In the zsh-3.1.5-pws-4 source) } } As far as I can tell, the newly allocated string that try(X) returns is } not assigned to anything at the four places in exec.c that it is used ... } so that string never gets freed. It's a macro. A return statement in a macro doesn't return anything from the macro, it returns it from the function that calls the macro. So the value is returned from findcmd(), and you have to look at the calls to findcmd() to see whether the string gets freed. I don't know who named the try() macro; it was a pretty awful choice, and conventionally any macro that refers to its argument more than once should be written in all upper case (to remind programmers not to call it with autoincremented parameters). Renaming try(X) to MAYBE_RETURN(X) or some such might be a good idea. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com