From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEdA7-0003sv-2e for qemu-devel@nongnu.org; Thu, 20 Sep 2012 05:35:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEdA1-0006FY-8G for qemu-devel@nongnu.org; Thu, 20 Sep 2012 05:35:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEdA1-0006CJ-0N for qemu-devel@nongnu.org; Thu, 20 Sep 2012 05:35:05 -0400 Message-ID: <505AE340.9070306@redhat.com> Date: Thu, 20 Sep 2012 11:34:56 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <20120917152149.GB6879@in.ibm.com> <20120917152620.GG6879@in.ibm.com> <50587ED6.9040504@redhat.com> <20120920064114.GD5873@in.ibm.com> <505ACB62.7020409@redhat.com> <505AD1D1.70604@redhat.com> <20120920091214.GE5873@in.ibm.com> In-Reply-To: <20120920091214.GE5873@in.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: bharata@linux.vnet.ibm.com Cc: Anthony Liguori , Anand Avati , Vijay Bellur , Stefan Hajnoczi , Amar Tumballi , qemu-devel@nongnu.org, Markus Armbruster , Blue Swirl , Avi Kivity , Paolo Bonzini Am 20.09.2012 11:12, schrieb Bharata B Rao: > On Thu, Sep 20, 2012 at 10:20:33AM +0200, Paolo Bonzini wrote: >> Il 20/09/2012 09:53, Paolo Bonzini ha scritto: >>>>>> Would look a bit nicer with strstart() form cutils.c instead of strncmp(). >>>>> strstart() works with const char pointers, but I have char pointers here >>>>> which I need to modify. >>> You can pass a char* to a function that accepts const char*. In your >>> case, the last argument to strstart would be NULL. >> >> As you pointed out on IRC, you meant the last argument. I don't think >> it would be a problem to cast that from char ** to const char **. >> >> Perhaps it would be cleaner to make qemu_gluster_parseuri and >> parse_gluster_spec accept a const char *. You can replace strtok_r + >> g_strdup with strspn/strcspn followed by g_strndup. > > I feel the current approach of using the combination of strncmp, strtok_r > and g_strdup should be good enough. Now that Paolo agreed that there wouldn't be a problem with casting, let's use strstart with a cast to (const char**) for the third parameter. Using strtok_r is okay with me. Kevin