Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 3/3] Constify two local variables.
- X-seq: zsh-workers 37298
- From: Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH 3/3] Constify two local variables.
- Date: Thu, 3 Dec 2015 23:37:19 +0000
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=a2NT5ZcS8QASTxqq7a7ls6EMOMw=; b=Ax9/Z/ M4+JFtV2M3dhybm6Zcf02jWeFM8rTzDQNq37cpMPJBvTRfCjkWhh3KDB2f5UiJKG kRm87Glk/iQypArcR2NNW7bbwpkTusmiZUG/LbRrQWWo0chIthJ6MIspdsP8SH+s uga8s+/EyE6BoO8lklEC0M6TANELV8035BL78=
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=a2NT5ZcS8QASTxqq7a7ls6EMOMw=; b=Gzcl1 F7DSr3A54xsIhnq6WeuCKuaxAc+7XSMovvD5BXzD7cnKK9TFRAxCbzb+6Hqn7piS O5biEYETezKB2sIUbiN/OeVC31Bew+igs5oqUzvu3P8RNsTsmDGf0flp6Zg/ax+E u0hHR8M9r46Y/Qg1PkS8B9ZA+LL4btCiYpo1yo=
- In-reply-to: <151201171121.ZM710@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20151202003654.GE2462@tarsus.local2> <151201171121.ZM710@torch.brasslantern.com>
Bart Schaefer wrote on Tue, Dec 01, 2015 at 17:11:21 -0800:
> On Dec 2, 12:36am, Daniel Shahaf wrote:
> } Subject: Re: [PATCH 3/3] Constify two local variables.
> }
> } #define N (sizeof(void*) * arrlen(vals))
> } vals = getfn()
> } munge_in_place(vals)
> } dummy = zalloc(N)
> } memcpy(dummy, vals, N)
> } setfn(dummy)
>
> Would that memcpy() really work, or would it need to be zarrdup() to copy
> each of the elements as well? Because e.g. arrsetfn() does freearray().
I think it would work, because setarrvalue() in HEAD calls freearray()
on the values array, implying that the individual elements are already
permanently allocated.
---
In the meantime I've found a reproducible invalid free() with this
patchset (reproducible by invoking _gnu_generic on ": Sr<TAB>" in the
source tree). I haven't investigated yet.
Daniel
Messages sorted by:
Reverse Date,
Date,
Thread,
Author