From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48313 invoked by alias); 29 Jun 2016 10:39:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 48301 invoked by uid 89); 29 Jun 2016 10:39:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f53.google.com Received: from mail-wm0-f53.google.com (HELO mail-wm0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 29 Jun 2016 10:39:15 +0000 Received: by mail-wm0-f53.google.com with SMTP id a66so66992545wme.0 for ; Wed, 29 Jun 2016 03:39:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=w/Psp/fmW+mx/2CjUZQ4bddp2InRUXN25inlwU3UytA=; b=jUrsNzj6p+6iKE5eN1pqdp8d4XqItFrUlU941UHyNnrg3/nI4Nkj469UTKbe/7ylsR oe9nAg21p7I4Szn3UKl3r7NDpWdhNhzYP9bepmiNd0B/Lv6KwvAOxjqjNoMvssl4Ueq2 rWkzmfObiwhpZ3jHiwuppS/ulNBlHDYyzNrpKHqL/geiAuQey/j2gOB4uNsePPadQJ4r sI+KzY5M5e6aWlOIIVuVnJsVbwVVUjefn2LHccWlkJfz5+rrcUVdmq2DInA56ar76wnk p3hhvs2O7+f81SbFPkAY3r7+bWO6b2ted5azCi6WP94RnVqLl2S6xk90DFvXUPrVDFq1 AxJg== X-Gm-Message-State: ALyK8tJA8xmgf17R3F5yc+YPmCAdAUOle03F3M6AY7/RdTlda+KCr9SEcJKqCNsMTz5aPMCVI8r/PW42dquOB4lB X-Received: by 10.28.94.135 with SMTP id s129mr8612773wmb.36.1467196752065; Wed, 29 Jun 2016 03:39:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.36.215 with HTTP; Wed, 29 Jun 2016 03:38:58 -0700 (PDT) In-Reply-To: <7ab96fcb-ffcd-c1ec-187d-f8ec05e43923@redhat.com> References: <7ab96fcb-ffcd-c1ec-187d-f8ec05e43923@redhat.com> From: Manish Goregaokar Date: Wed, 29 Jun 2016 10:39:00 -0000 Message-ID: Subject: Re: [PATCH] Use strtok_r instead of strsep in rust_get_disr_info To: Pedro Alves Cc: gdb-patches@sourceware.org, Tom Tromey Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-06/txt/msg00503.txt.bz2 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 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 >