From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16340 invoked by alias); 21 Jul 2006 11:35:41 -0000 Received: (qmail 16327 invoked by uid 22791); 21 Jul 2006 11:35:40 -0000 X-Spam-Check-By: sourceware.org Received: from potter.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 21 Jul 2006 11:35:38 +0000 Received: (qmail 346 invoked from network); 21 Jul 2006 11:35:36 -0000 Received: from unknown (HELO zigzag.lvk.cs.msu.su) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 21 Jul 2006 11:35:36 -0000 From: Vladimir Prus To: Eli Zaretskii Subject: Re: Flash support part 1: memory maps Date: Fri, 21 Jul 2006 11:35:00 -0000 User-Agent: KMail/1.7.2 Cc: gdb-patches@sources.redhat.com References: <200607201341.34070.vladimir@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200607211535.30236.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00288.txt.bz2 On Thursday 20 July 2006 23:32, Eli Zaretskii wrote: > > From: Vladimir Prus > > 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? That sound like a good idea; I just did not want to create too many files when there's just one user of those functions. > > + /* 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. Sorry, will fix. > > + 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? Ah, yea, we don't need this in C. - Volodya