From: "Jan Beulich" Subject: Re: [PATCH 2/7] common/vsprintf: Refactor pointer() out of vsnprintf() Date: Tue, 05 Nov 2013 10:21:34 +0000 Message-ID: <5278D4BE02000078000FF70E@nat28.tlf.novell.com> References: <1383600624-6345-1-git-send-email-andrew.cooper3@citrix.com> <1383600624-6345-3-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VddlS-0006p7-Np for xen-devel@lists.xenproject.org; Tue, 05 Nov 2013 10:21:38 +0000 In-Reply-To: <1383600624-6345-3-git-send-email-andrew.cooper3@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 04.11.13 at 22:30, Andrew Cooper wrote: > No fuctional change functional > + str = number(str, end, val, 16, field_width, precision, flags); > + > + return str; Why not simply "return number(...);"? > @@ -399,13 +414,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) > continue; > > case 'p': > - if (field_width == -1) { > - field_width = 2*sizeof(void *); > - flags |= ZEROPAD; > - } > - str = number(str, end, > - (unsigned long) va_arg(args, void *), > - 16, field_width, precision, flags); > + str = pointer(str, end, (unsigned long) va_arg(args, void *), > + field_width, precision, flags); The va_arg() result clearly shouldn't be cast here, even if both the use here and that added by the next patch require this. I'm definitely planning on adding a modifier to print domain/vcpu IDs as a pair from a single "struct vcpu *" argument, and such code shouldn't be required to cast back from "unsigned long" to a pointer. Jan