This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add type_sprint() function to return type in string form


On Tue, Apr 22, 2003 at 12:48:09PM -0400, Andrew Cagney wrote:
> >On Fri, Apr 18, 2003 at 03:24:26PM -0700, Jason Molenda wrote:
> >
> >>There are a few places in gdb where code prints an error message
> >>with a type included in it.  The only way for these functions to
> >>print a type is with type_print(), which takes a ui_file stream to
> >>print its output to.  This means they either have to send the output
> >>to gdb_stderr, or build up a fake memory ui_file and retrieve the
> >>contents.
> >>
> >>This patch adds a type_sprint() which does the latter and returns the
> >>xmalloc()'ed string.
> 
> Good interface choice!  Just some tweaks.
> 
> sprint makes me think of the nasty sprintf family, which this is 
> definitly not.  So ..  suggest calling it something like type_xstrdup: 
> x-> xmalloc family; strdup -> allocate a string duplicate (like 
> ui_file_xstrdup, but yes pushing it a bit).  The alternative would be 
> type_xasprint (&string, ...) but I think that is getting ugly :-)

How about type_asprint?  I really don't think that the x is necessary,
but the a would be a convenient reminder.

> The old error message should never have included a period ("."), might 
> as well remove it while tweaking the code.

Didn't we settle on full sentence error messages the last time this
came up?


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]