This is the mail archive of the gdb-patches@sourceware.org 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 support for imported declaration and correct search order


>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

>> +    retval->declaration = savestring (declaration, strlen (declaration));

Jan> (sure really only a nitpick)

That is what 70% of my reviews consist of :-)

Jan> These savestring calls can be simplified to:
Jan> # +    retval->declaration = xstrdup (declaration);
Jan> as was cleaned up by:
Jan> 	[obv] Replace savestring by xstrdup where possible
Jan> 	http://sourceware.org/ml/gdb-patches/2009-05/msg00516.html
Jan> but new `savestring (X, strlen (X))' calls apparently crept in
Jan> since that time.

Yes, thanks -- I forgot about this.  In this case I think these have to
be replaced with obstack allocations anyhow, since currently they are
all leaked.

According to the appended semantic patch, the uses of savestring in this
function are the only "bad" ones.

Tom

@@
expression e;
@@

- savestring (e, strlen (e))
+ xstrdup (e)


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