Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH 3/3] Constify two local variables.
- X-seq: zsh-workers 37300
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH 3/3] Constify two local variables.
- Date: Thu, 3 Dec 2015 16:36:17 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=9R/cagvCTiessKI9C88gDpEaFMztmJhTZ8Ohnup1gB0=; b=QIaZjZukVJfIkrovHjHAR1GdxMbJET4Rl83551hDm1wW0nfQRK5Jxbn9fo4iihUhlc d2SdLC9uEGgn8s7DgDlI9eldslrJLoSG4ar20NoroTXrsUVipzKQL9iLmWfiRyc+Ewkf CbdfZxkNphH/f7O1C1tYXlMCa3GUtnhkqm45mxmPC3d1j1rF8PdwHHZqgCBls43ODzOw nACwcp/6aiL1ekhS80372wWD0axlNTFUcxh1t9Sbr/2ujXi4bMDDi/OPudhZE7DxfVNv qr6rRElft36dJlF9eI5PGyr72dhwsHM8Ea6vJWdRfMeLn+IdY3XlFuy8ALJV53r1Gv5y ntig==
- In-reply-to: <20151203233719.GE1955@tarsus.local2>
- 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> <20151203233719.GE1955@tarsus.local2>
On Dec 3, 11:37pm, Daniel Shahaf wrote:
} Subject: Re: [PATCH 3/3] Constify two local variables.
}
} Bart Schaefer wrote on Tue, Dec 01, 2015 at 17:11:21 -0800:
} > On Dec 2, 12:36am, Daniel Shahaf wrote:
} > }
} > } 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.
That's exactly why I think it would NOT work! If you memcp() only the
pointers and then pass a new pointer-to-pointer into arrsetfn(), it's
going to call freearray() and discard all the individual pointers that
you intended would become the [re-used] elements.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author