From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Vibhav Pant Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Make purecopy create hash tables properly Date: Mon, 30 Jan 2017 00:44:45 +0530 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a114d72ea0cd83f05474083b9 X-Trace: blaine.gmane.org 1485717330 18703 195.159.176.226 (29 Jan 2017 19:15:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 29 Jan 2017 19:15:30 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jan 29 20:15:26 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cXuwf-0004bd-M8 for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2017 20:15:25 +0100 Original-Received: from localhost ([::1]:56430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXuwl-0005eo-3f for ged-emacs-devel@m.gmane.org; Sun, 29 Jan 2017 14:15:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXuw6-0005ej-DU for emacs-devel@gnu.org; Sun, 29 Jan 2017 14:14:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXuw2-0003yO-I5 for emacs-devel@gnu.org; Sun, 29 Jan 2017 14:14:50 -0500 Original-Received: from mail-yw0-x231.google.com ([2607:f8b0:4002:c05::231]:33833) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXuw2-0003yC-CH for emacs-devel@gnu.org; Sun, 29 Jan 2017 14:14:46 -0500 Original-Received: by mail-yw0-x231.google.com with SMTP id w75so44876541ywg.1 for ; Sun, 29 Jan 2017 11:14:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5/wQ3n08zUgYM+FoVWtBkG9161HKM1/iEXU0T6WFjDM=; b=TOW1it0siLt0rzDZqkykFDGNw3WbBpamTqEoBLGCWYKaqL52s4eONwhTZlSG0zde0s +vsh0x2FSytBsgRXgJIOQKE7lHu0P145kkWJtiSwfntAggHXPqEA8FqSFwriUpsmqe4V xXPRbK2zqhPpmmsJ6H/LbpCjQ84/TnPmmKTwLTCO1C2nkBak+KLHSf+1HkbCEfSDRNEt 3M4uBtvRaSOCAwn2VDpxKsnJys8KfYy3l75Lgevd+dxa1bha+NX0YAlelm+9qSrbJ02r G9Eoq3q8a79kSnWXHJ6Fq0+Kpv/OOshu+Oe04GkNFshftgbMwY6zW15C4AGXfXSs5MB4 X+rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5/wQ3n08zUgYM+FoVWtBkG9161HKM1/iEXU0T6WFjDM=; b=J6ZLjN6qihXwMhip2g0OcFa+2gfZCr+mttHNsUZGeEBut65juHPgAJ/ZHSf2LV34Qh giDR3Epm0NEIPiCHUT98qOor2UJmg7uBSb1xIa+8t3k+loNpgJZAT1FYzryG8izqwBWP 9k90HynHg61G/s80quAw8J+ptv+YLX7AQYlZ7iGABQEql1oSTEhu4XWi5cHBiV1g97Rs q2Q5hkYaH4IyIN9jzgeq0X0yNsZIZmJxv5bYJpcVtVhE/IbFQQx1N9TbdFU+YL97rbcI 7Fc6NyDf3efMzPpEWn0TZaDZBWiFuKNCoATBvLt4K0W81lw7Ec7KTAnTcYvW2RUX3j7p QsYg== X-Gm-Message-State: AIkVDXIANz694eQTzTbMqLNM01Wez2ypahn7zq+KHLhl8DWfwHDOa7TX3M6ojQ3AKy3O3M2Y1b6wwfQmMtGWXg== X-Received: by 10.129.71.11 with SMTP id u11mr12122118ywa.79.1485717285687; Sun, 29 Jan 2017 11:14:45 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Sun, 29 Jan 2017 11:14:45 -0800 (PST) Original-Received: by 10.129.153.77 with HTTP; Sun, 29 Jan 2017 11:14:45 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4002:c05::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211732 Archived-At: --001a114d72ea0cd83f05474083b9 Content-Type: text/plain; charset=UTF-8 On 29-Jan-2017 11:29 PM, "Stefan Monnier" wrote: Hmm... why do that in gethash? Why not just check NILP (obj->weak) when purecopying? The rationale for this was that weak tables wouldn't be purecopied, so it might be a good idea to inform the user about that beforhand. The simple NILP (obj->weak) check in purecopy is much easier and wouldn't generate errors, I'll switch to that instead. > Should this work, or is there anything else I need to do? I think this should work. Alright then, I'll push this to master after adding some more documentation. > +make_pure_hash_table (struct Lisp_Hash_Table *table) { Nitpick: I'd call it `purecopy_hash_table`. Other functions in alloc.c that perform pure allocation for different objects are named in the same way (make_pure_string, make_pure_vector), so I merely followed this convention. --001a114d72ea0cd83f05474083b9 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On 29-Jan-2017 11:29 PM, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote= :
Hmm... why do that in gethash?=C2=A0 Why not just= check NILP (obj->weak)
when purecopying?
The rationale for this was that weak tables wouldn't be purecopi= ed, so it might be a good idea to inform the user about that beforhand. The= simple NILP (obj->weak) check in purecopy is much easier and wouldn'= ;t generate errors, I'll switch to that instead.

> Should this work, or is there anything else I need to do?

I think this should work.
Alright then, I'll push this to master after adding some more= documentation.
> +make_pure_hash_table (struct Lisp_Hash_Table *table) {

Nitpick: I'd call it `purecopy_hash_table`.
Other functions in alloc.c that perform pure allocatio= n for different objects are named in the same way (make_pure_string, make_p= ure_vector), so I merely followed this convention.=C2=A0

--001a114d72ea0cd83f05474083b9--