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: [RFA] Use unique_xmalloc_ptr in Python code


>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> IMO, for simplicity sake, we should default to use std::string, unless
Pedro> we're ending up storing the result in some long lived objects where
Pedro> memory really is a concern (because of many instances), and a final
Pedro> string dup/copy to destination wouldn't be too heavy too.  I doubt
Pedro> that's the case here, but it's not easy to see without trying.
Pedro> Did you try a std::string approach first?

Nope, I had just started with unique_xmalloc_ptr, and then noticed a few
spots -- basically anywhere in the patch calling .release() -- where the
ownership is passed on.

I didn't really consider that copying the string would be ok.  I agree
it is, I think I was just being conservative in preserving existing
behavior.

Pedro> In any case, this is strictly an improvement, so OK with me.  Please
Pedro> push.  Let's get this out of the way of your py-ref series.
Pedro> We can convert to std::string at some other point, if desirable.

Will do.  Thanks.

Tom


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