Re: [PATCH 4/4] Explicitly type void* pointers
authorJani Nikula <jani@nikula.org>
Mon, 9 Apr 2012 11:04:36 +0000 (14:04 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:10 +0000 (09:46 -0800)
15/3bcbee42ba20bb7137e76a3b08f7cdf560f648 [new file with mode: 0644]

diff --git a/15/3bcbee42ba20bb7137e76a3b08f7cdf560f648 b/15/3bcbee42ba20bb7137e76a3b08f7cdf560f648
new file mode 100644 (file)
index 0000000..8ca4845
--- /dev/null
@@ -0,0 +1,234 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4E1D841646B\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Apr 2012 04:04:43 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.699\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.699 tagged_above=-999 required=5\r
+       tests=[HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id iK25wv0aGCTb for <notmuch@notmuchmail.org>;\r
+       Mon,  9 Apr 2012 04:04:38 -0700 (PDT)\r
+Received: from mail-pz0-f45.google.com (mail-pz0-f45.google.com\r
+       [209.85.210.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 65B0140350B\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Apr 2012 04:04:38 -0700 (PDT)\r
+Received: by dacx6 with SMTP id x6so5280608dac.18\r
+       for <notmuch@notmuchmail.org>; Mon, 09 Apr 2012 04:04:36 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
+       :cc:content-type:x-gm-message-state;\r
+       bh=DMaTsGyQ0fnka8YnIf1de0yUj/e8KP8in5l5awM5Hao=;\r
+       b=QdlForbXbdh4DdVClwuwfsuDM5aDIU5970GbTyHpKD/JKPY1RZh34IkJ6HND/JLIOI\r
+       W4OqBe1xsc6uTxcx8icH4hXLsOFl5pa9pEGB63rx3L9gyt1738R2vcVBWBGfkPUT5QvB\r
+       FkzWPzpc98U7D+GB0ylE9tyhqsU9eWWzUMzQkSYjopc5WrC14EvPB7kXDlIA0PGMhDoJ\r
+       ED98x/4MFVhhcpKXVVq8fag/Nzr4EWoVIFfvmvxrrQlAHlBBbsN8gCsqBUBryi8n6KPA\r
+       UG+PimtsHqqzntwgh4U5awj9eapS5esAA2J44jDkl6mSinBnQsbz175Ctea0Jr2JaHyc\r
+       1dUA==\r
+MIME-Version: 1.0\r
+Received: by 10.68.218.33 with SMTP id pd1mr3432994pbc.96.1333969476450; Mon,\r
+       09 Apr 2012 04:04:36 -0700 (PDT)\r
+Received: by 10.68.241.234 with HTTP; Mon, 9 Apr 2012 04:04:36 -0700 (PDT)\r
+Received: by 10.68.241.234 with HTTP; Mon, 9 Apr 2012 04:04:36 -0700 (PDT)\r
+In-Reply-To: <1333966665-10469-5-git-send-email-Vladimir.Marek@oracle.com>\r
+References: <1333966665-10469-1-git-send-email-Vladimir.Marek@oracle.com>\r
+       <1333966665-10469-5-git-send-email-Vladimir.Marek@oracle.com>\r
+Date: Mon, 9 Apr 2012 14:04:36 +0300\r
+Message-ID:\r
+ <CAB+hUn_QyMAfC1-Dr23T63ObX=cwuBOzcyCi=61w0MtGRMyt2w@mail.gmail.com>\r
+Subject: Re: [PATCH 4/4] Explicitly type void* pointers\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Vladimir.Marek@oracle.com\r
+Content-Type: multipart/alternative; boundary=e89a8ff245dbc8f92104bd3cf8df\r
+X-Gm-Message-State:\r
+ ALoCoQk3BHjsBclIFFa+GRKRcIbofqVYPprDTZHJj4ax/pY1LpKVcroVdCqx57ODi48kyZmOEBfc\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>, Vladimir Marek <vlmarek@volny.cz>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 09 Apr 2012 11:04:43 -0000\r
+\r
+--e89a8ff245dbc8f92104bd3cf8df\r
+Content-Type: text/plain; charset=UTF-8\r
+\r
+Hi, does notmuch not compile without this? IIRC talloc_steal is a macro\r
+that's supposed to provide type safety (at least with GCC), and I'd be\r
+hesitant about adding the casts. Please look in your talloc.h.\r
+\r
+BR,\r
+Jani.\r
+\r
+On Apr 9, 2012 1:19 PM, <Vladimir.Marek@oracle.com> wrote:\r
+>\r
+> From: Vladimir Marek <vlmarek@volny.cz>\r
+>\r
+>\r
+> Signed-off-by: Vladimir Marek <vlmarek@volny.cz>\r
+> ---\r
+>  lib/database.cc |    2 +-\r
+>  lib/message.cc  |    2 +-\r
+>  lib/thread.cc   |    2 +-\r
+>  3 files changed, 3 insertions(+), 3 deletions(-)\r
+>\r
+> diff --git a/lib/database.cc b/lib/database.cc\r
+> index 16c4354..3c82632 100644\r
+> --- a/lib/database.cc\r
+> +++ b/lib/database.cc\r
+> @@ -1361,7 +1361,7 @@ _resolve_message_id_to_thread_id\r
+(notmuch_database_t *notmuch,\r
+>        return status;\r
+>\r
+>     if (message) {\r
+> -       *thread_id_ret = talloc_steal (ctx,\r
+> +       *thread_id_ret = (const char*)talloc_steal (ctx,\r
+>                                       notmuch_message_get_thread_id\r
+(message));\r
+>\r
+>        notmuch_message_destroy (message);\r
+> diff --git a/lib/message.cc b/lib/message.cc\r
+> index 0075425..d56d442 100644\r
+> --- a/lib/message.cc\r
+> +++ b/lib/message.cc\r
+> @@ -220,7 +220,7 @@ _notmuch_message_create_for_message_id\r
+(notmuch_database_t *notmuch,\r
+>\r
+ message_id,\r
+>\r
+ &message);\r
+>     if (message)\r
+> -       return talloc_steal (notmuch, message);\r
+> +       return (notmuch_message_t*) talloc_steal (notmuch, message);\r
+>     else if (*status_ret)\r
+>        return NULL;\r
+>\r
+> diff --git a/lib/thread.cc b/lib/thread.cc\r
+> index e976d64..d41ff3e 100644\r
+> --- a/lib/thread.cc\r
+> +++ b/lib/thread.cc\r
+> @@ -225,7 +225,7 @@ _thread_add_message (notmuch_thread_t *thread,\r
+>     char *clean_author;\r
+>\r
+>     _notmuch_message_list_add_message (thread->message_list,\r
+> -                                      talloc_steal (thread, message));\r
+> +                                      (_notmuch_message*)talloc_steal\r
+(thread, message));\r
+>     thread->total_messages++;\r
+>\r
+>     g_hash_table_insert (thread->message_hash,\r
+> --\r
+> 1.7.3.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--e89a8ff245dbc8f92104bd3cf8df\r
+Content-Type: text/html; charset=UTF-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+<p><br>\r
+Hi, does notmuch not compile without this? IIRC talloc_steal is a macro tha=\r
+t&#39;s supposed to provide type safety (at least with GCC), and I&#39;d be=\r
+ hesitant about adding the casts. Please look in your talloc.h.</p>\r
+<p>BR,<br>\r
+Jani.<br></p>\r
+<p>On Apr 9, 2012 1:19 PM, &lt;<a href=3D"mailto:Vladimir.Marek@oracle.com"=\r
+>Vladimir.Marek@oracle.com</a>&gt; wrote:<br>\r
+&gt;<br>\r
+&gt; From: Vladimir Marek &lt;<a href=3D"mailto:vlmarek@volny.cz">vlmarek@v=\r
+olny.cz</a>&gt;<br>\r
+&gt;<br>\r
+&gt;<br>\r
+&gt; Signed-off-by: Vladimir Marek &lt;<a href=3D"mailto:vlmarek@volny.cz">=\r
+vlmarek@volny.cz</a>&gt;<br>\r
+&gt; ---<br>\r
+&gt; =C2=A0lib/database.cc | =C2=A0 =C2=A02 +-<br>\r
+&gt; =C2=A0lib/message.cc =C2=A0| =C2=A0 =C2=A02 +-<br>\r
+&gt; =C2=A0lib/thread.cc =C2=A0 | =C2=A0 =C2=A02 +-<br>\r
+&gt; =C2=A03 files changed, 3 insertions(+), 3 deletions(-)<br>\r
+&gt;<br>\r
+&gt; diff --git a/lib/database.cc b/lib/database.cc<br>\r
+&gt; index 16c4354..3c82632 100644<br>\r
+&gt; --- a/lib/database.cc<br>\r
+&gt; +++ b/lib/database.cc<br>\r
+&gt; @@ -1361,7 +1361,7 @@ _resolve_message_id_to_thread_id (notmuch_databa=\r
+se_t *notmuch,<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0return status;<br>\r
+&gt;<br>\r
+&gt; =C2=A0 =C2=A0 if (message) {<br>\r
+&gt; - =C2=A0 =C2=A0 =C2=A0 *thread_id_ret =3D talloc_steal (ctx,<br>\r
+&gt; + =C2=A0 =C2=A0 =C2=A0 *thread_id_ret =3D (const char*)talloc_steal (c=\r
+tx,<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_mess=\r
+age_get_thread_id (message));<br>\r
+&gt;<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0notmuch_message_destroy (message);<br>\r
+&gt; diff --git a/lib/message.cc b/lib/message.cc<br>\r
+&gt; index 0075425..d56d442 100644<br>\r
+&gt; --- a/lib/message.cc<br>\r
+&gt; +++ b/lib/message.cc<br>\r
+&gt; @@ -220,7 +220,7 @@ _notmuch_message_create_for_message_id (notmuch_da=\r
+tabase_t *notmuch,<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0message_id,<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =\r
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;message);<br>\r
+&gt; =C2=A0 =C2=A0 if (message)<br>\r
+&gt; - =C2=A0 =C2=A0 =C2=A0 return talloc_steal (notmuch, message);<br>\r
+&gt; + =C2=A0 =C2=A0 =C2=A0 return (notmuch_message_t*) talloc_steal (notmu=\r
+ch, message);<br>\r
+&gt; =C2=A0 =C2=A0 else if (*status_ret)<br>\r
+&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;<br>\r
+&gt;<br>\r
+&gt; diff --git a/lib/thread.cc b/lib/thread.cc<br>\r
+&gt; index e976d64..d41ff3e 100644<br>\r
+&gt; --- a/lib/thread.cc<br>\r
+&gt; +++ b/lib/thread.cc<br>\r
+&gt; @@ -225,7 +225,7 @@ _thread_add_message (notmuch_thread_t *thread,<br>\r
+&gt; =C2=A0 =C2=A0 char *clean_author;<br>\r
+&gt;<br>\r
+&gt; =C2=A0 =C2=A0 _notmuch_message_list_add_message (thread-&gt;message_li=\r
+st,<br>\r
+&gt; - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0talloc_st=\r
+eal (thread, message));<br>\r
+&gt; + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=\r
+=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(_notmuch=\r
+_message*)talloc_steal (thread, message));<br>\r
+&gt; =C2=A0 =C2=A0 thread-&gt;total_messages++;<br>\r
+&gt;<br>\r
+&gt; =C2=A0 =C2=A0 g_hash_table_insert (thread-&gt;message_hash,<br>\r
+&gt; --<br>\r
+&gt; 1.7.3.2<br>\r
+&gt;<br>\r
+&gt; _______________________________________________<br>\r
+&gt; notmuch mailing list<br>\r
+&gt; <a href=3D"mailto:notmuch@notmuchmail.org">notmuch@notmuchmail.org</a>=\r
+<br>\r
+&gt; <a href=3D"http://notmuchmail.org/mailman/listinfo/notmuch">http://not=\r
+muchmail.org/mailman/listinfo/notmuch</a><br>\r
+</p>\r
+\r
+--e89a8ff245dbc8f92104bd3cf8df--\r