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


+Hi, does notmuch not compile without this? IIRC talloc_steal is a macro tha= +t's supposed to provide type safety (at least with GCC), and I'd be= + hesitant about adding the casts. Please look in your talloc.h.

+

BR,
+Jani.

+

On Apr 9, 2012 1:19 PM, <Vladimir.Marek@oracle.com> wrote:
+>
+> From: Vladimir Marek <vlmarek@v= +olny.cz>
+>
+>
+> Signed-off-by: Vladimir Marek <= +vlmarek@volny.cz>
+> ---
+> =C2=A0lib/database.cc | =C2=A0 =C2=A02 +-
+> =C2=A0lib/message.cc =C2=A0| =C2=A0 =C2=A02 +-
+> =C2=A0lib/thread.cc =C2=A0 | =C2=A0 =C2=A02 +-
+> =C2=A03 files changed, 3 insertions(+), 3 deletions(-)
+>
+> diff --git a/lib/database.cc b/lib/database.cc
+> index 16c4354..3c82632 100644
+> --- a/lib/database.cc
+> +++ b/lib/database.cc
+> @@ -1361,7 +1361,7 @@ _resolve_message_id_to_thread_id (notmuch_databa= +se_t *notmuch,
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0return status;
+>
+> =C2=A0 =C2=A0 if (message) {
+> - =C2=A0 =C2=A0 =C2=A0 *thread_id_ret =3D talloc_steal (ctx,
+> + =C2=A0 =C2=A0 =C2=A0 *thread_id_ret =3D (const char*)talloc_steal (c= +tx,
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 notmuch_mess= +age_get_thread_id (message));
+>
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0notmuch_message_destroy (message);
+> diff --git a/lib/message.cc b/lib/message.cc
+> index 0075425..d56d442 100644
+> --- a/lib/message.cc
+> +++ b/lib/message.cc
+> @@ -220,7 +220,7 @@ _notmuch_message_create_for_message_id (notmuch_da= +tabase_t *notmuch,
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= +=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0message_id,
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= +=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&message);
+> =C2=A0 =C2=A0 if (message)
+> - =C2=A0 =C2=A0 =C2=A0 return talloc_steal (notmuch, message);
+> + =C2=A0 =C2=A0 =C2=A0 return (notmuch_message_t*) talloc_steal (notmu= +ch, message);
+> =C2=A0 =C2=A0 else if (*status_ret)
+> =C2=A0 =C2=A0 =C2=A0 =C2=A0return NULL;
+>
+> diff --git a/lib/thread.cc b/lib/thread.cc
+> index e976d64..d41ff3e 100644
+> --- a/lib/thread.cc
+> +++ b/lib/thread.cc
+> @@ -225,7 +225,7 @@ _thread_add_message (notmuch_thread_t *thread,
+> =C2=A0 =C2=A0 char *clean_author;
+>
+> =C2=A0 =C2=A0 _notmuch_message_list_add_message (thread->message_li= +st,
+> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= +=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0talloc_st= +eal (thread, message));
+> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= +=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(_notmuch= +_message*)talloc_steal (thread, message));
+> =C2=A0 =C2=A0 thread->total_messages++;
+>
+> =C2=A0 =C2=A0 g_hash_table_insert (thread->message_hash,
+> --
+> 1.7.3.2
+>
+> _______________________________________________
+> notmuch mailing list
+> notmuch@notmuchmail.org= +
+> http://not= +muchmail.org/mailman/listinfo/notmuch
+

+ +--e89a8ff245dbc8f92104bd3cf8df-- -- 2.26.2