Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: Marco Barisione <mbarisione@undo.io>
Subject: Re: [PATCH] Add gdb.Value.format_string ()
Date: Sun, 17 Mar 2019 20:50:00 -0000	[thread overview]
Message-ID: <20190317135023.2e51944d@f29-4.lan> (raw)
In-Reply-To: <E62C5EB4-EB3F-4E5B-881B-EA3F11B5F9EB@undo.io>

Hi Marco,

Overall, I like this patch.  See below for my comments.

Kevin

On Sat, 16 Mar 2019 11:18:36 +0000
Marco Barisione <mbarisione@undo.io> wrote:

> gdb/doc/ChangeLog:
> 
> 2019-03-16  Marco Barisione  <mbarisione@undo.io>
> 
> 	* python.texi: Document gdb.Value.format_string ()

A period is needed at the end of this ChangeLog entry.

> diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
> index dd6a536b6a..46a0f563e4 100644
> --- a/gdb/python/py-value.c
> +++ b/gdb/python/py-value.c
> @@ -588,6 +588,162 @@ valpy_string (PyObject *self, PyObject *args, PyObject *kw)
>  			   encoding, errors);
>  }
>  
> +/* Given a Python object, copy its truth value to a C int (the value
> +   pointed by dest).
> +   If src_obj is NULL, then *dest is not modified.
> +
> +   Return 1 in case of success, -1 otherwise.  */

Why not use a bool return type to indicate success or failure?

> +
> +static int
> +copy_py_bool_obj (int *dest, PyObject *src_obj)
> +{
> +  if (src_obj)
> +    {
> +      int cmp = PyObject_IsTrue (src_obj);
> +      if (cmp < 0)
> +	return -1;
> +      *dest = cmp;
> +    }
> +
> +  return 1;
> +}


  reply	other threads:[~2019-03-17 20:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-16 11:18 Marco Barisione
2019-03-17 20:50 ` Kevin Buettner [this message]
2019-03-17 23:41   ` Marco Barisione
2019-03-18  9:22   ` [PATCH v2] " Marco Barisione
2019-03-18 16:34     ` Kevin Buettner
2019-03-18 17:49       ` Eli Zaretskii
2019-03-18 18:17       ` [PATCH v3] " Marco Barisione
2019-03-27 20:16         ` Tom Tromey
2019-03-28 13:55           ` [PATCH v4] " Marco Barisione
2019-03-29 15:03             ` Tom Tromey
2019-04-12 20:18             ` New failures on gdb.python/py-format-string.exp - unix/-m32 (was: Re: [PATCH v4] Add gdb.Value.format_string ()) Sergio Durigan Junior
     [not found]       ` <D8FDF6CA-2755-4AC2-BE63-A76311F566E6@undo.io>
2019-03-18 20:00         ` [PATCH v3] Add gdb.Value.format_string () Eli Zaretskii
2019-03-18 21:49           ` [PATCH v4] " Marco Barisione
2019-03-19  6:48             ` Eli Zaretskii
2019-03-26 12:07             ` [PING][PATCH " Marco Barisione
2019-03-18 17:49     ` [PATCH v2] " Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190317135023.2e51944d@f29-4.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mbarisione@undo.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox