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 4/7] [python] API for macros: Add methods to get a gdb.Macro.


Matt Rice <ratmice@gmail.com> writes:

>>>>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>>>>
>>>> Phil> I think this should return a Tuple. ÂTuples are immutable, and unless
>>>> Phil> you for see a use for the user to manipulate the List, we should guard
>>>> Phil> against it. ÂIf you agree, please alter stpy_macros too.
>>>>
>>>> Using a tuple means you have to iterate twice -- once to count the
>>>> objects and once to make the tuple.
>>>
>>> You can use a list, and then convert it to a tuple:
>>>
>>> PyList_AsTuple
>>>
>>> We already use the above.
>>>
>>> If you wanted to, you could use PyTuple_Ruse, as long as there is
>>> one reference to the tuple.
>>
>> Apologies for the typos, but the above should read:
>>
>> ÂIf you wanted too, you could use PyTuple_Resize, as long as there is
>> Âonly one reference to the tuple.
>
>
> I will try these out, (convert list->tuple and PyTuple_Resize()),
> but PyTuple_Resize is going to use realloc, which could end up moving it...

Actually, just leave them.  I thought about it some more, and with the
macro counts being so incredibly large in some projects, I think just
returning a list here would avoid large allocs/reallocs.  So Tom was
right, I was wrong.  All normal ;)

Cheers

Phil


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