Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Flash support part 1: memory maps
Date: Thu, 20 Jul 2006 19:32:00 -0000	[thread overview]
Message-ID: <u4pxchy1x.fsf@gnu.org> (raw)
In-Reply-To: <200607201341.34070.vladimir@codesourcery.com> (message from 	Vladimir Prus on Thu, 20 Jul 2006 13:41:33 +0400)

> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Thu, 20 Jul 2006 13:41:33 +0400
> 
> this patch is part of my work to add flash memory programming support to gdb. 

Thanks; my comments below.  (Note that I'm not the responsible
maintainer for this are of GDB, though.)

> +/* Parse a field VALSTR that we expect to contain an integer value.
> +   The integer is returned in *VALP.
> +   The string is parsed with the strtoul rountine.
> +
> +   Returns 0 for success, -1 for error.  */
> +static int
> +xml_parse_unsigned_integer (const char *valstr, unsigned long *valp)

Why is this (and other xml_* functions) here?  They seem to be pretty
much unrelated to memory-map.c, and I'd guess that other features that
use XML will want them.  How about a separate file, say gdb-xml.c or
something?

> +  /* Expat interface does not guarantee that a single call to
> +     a handler will be made. Actually, one call for each line
> +     will be made, and character data can possibly span several
> +     lines.
> +
> +     Take care to realloc the data if needed.
> +  */  

This style of comments is not the one prescribed by the GNU coding
standards.

> +  if (!data->character_data)
> +    data->character_data = (char *)malloc (len + 1);
> +  else
> +    {
> +      current_size = strlen (data->character_data);
> +      data->character_data = (char *)realloc (data->character_data,
> +                                              current_size + len + 1);

Why do we need to cast the results of malloc and realloc?


  reply	other threads:[~2006-07-20 19:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-20  9:41 Vladimir Prus
2006-07-20 19:32 ` Eli Zaretskii [this message]
2006-07-21 11:35   ` Vladimir Prus
2006-07-21 15:20     ` Eli Zaretskii
2006-07-31 13:00       ` Vladimir Prus
2006-07-31 13:20         ` Vladimir Prus
2006-07-31 22:09           ` Mark Kettenis
2006-08-01  0:53             ` Daniel Jacobowitz
2006-08-01  5:11             ` Vladimir Prus
2006-08-16 20:05 ` Daniel Jacobowitz
2006-09-21 13:56   ` Daniel Jacobowitz

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=u4pxchy1x.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sources.redhat.com \
    --cc=vladimir@codesourcery.com \
    /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