From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEcmT-0004Bg-Qm for qemu-devel@nongnu.org; Thu, 20 Sep 2012 05:10:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TEcmK-0005x8-9T for qemu-devel@nongnu.org; Thu, 20 Sep 2012 05:10:45 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:39010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TEcmJ-0005uP-MC for qemu-devel@nongnu.org; Thu, 20 Sep 2012 05:10:36 -0400 Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 20 Sep 2012 19:08:22 +1000 Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8K91BZv22413446 for ; Thu, 20 Sep 2012 19:01:12 +1000 Received: from d23av04.au.ibm.com (loopback [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8K9ARrJ023996 for ; Thu, 20 Sep 2012 19:10:27 +1000 Date: Thu, 20 Sep 2012 14:42:14 +0530 From: Bharata B Rao Message-ID: <20120920091214.GE5873@in.ibm.com> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <505AD1D1.70604@redhat.com> Subject: Re: [Qemu-devel] [PATCH v7 5/5] block: Support GlusterFS as a QEMU block backend. Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Anthony Liguori , Anand Avati , Vijay Bellur , Stefan Hajnoczi , Amar Tumballi , qemu-devel@nongnu.org, Markus Armbruster , Blue Swirl , Avi Kivity 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. But if you feel and insist that the right way to do this is to use the combination of strstart, strspn and g_strndup, I could give it a try. Regards, Bharata.