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] Use strtok_r instead of strsep in rust_get_disr_info


strsep moves the pointer to the end of the string. We want to ensure
the early break happens, since we need token to contain the name of
the variant at this stage.

strtok doesn't do this. However, strtok does make it NULL, which we
don't want either. I added a check for it in my most recent email,
tests still pass.

Thanks,
-Manish


On Wed, Jun 29, 2016 at 4:06 PM, Pedro Alves <palves@redhat.com> wrote:
> On 06/29/2016 11:31 AM, Manish Goregaokar wrote:
>> @@ -161,8 +163,6 @@ rust_get_disr_info (struct type *type, const
>> gdb_byte *valaddr,
>>            member_type = TYPE_FIELD_TYPE (member_type, fieldno);
>>          }
>>
>> -      if (token >= name + strlen (TYPE_FIELD_NAME (type, 0)))
>> -    error (_("Invalid form for %s"), RUST_ENUM_PREFIX);
>>        value = unpack_long (member_type, valaddr + embedded_offset);
>>
>>        if (value == 0)
>
> Why was this bit removed?
>
> Thanks,
> Pedro Alves
>


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