From nobody Wed May 8 01:05:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1582554201; cv=none; d=zohomail.com; s=zohoarc; b=mm/YogV/yQOsBkR9YdNE+IC6eTpSBTH+cW+LxICzqMUKZAGfjLrUdVJcunxXyMWCxUEc7as3HHzmxl5AlNT7aPNonaotll5nl4sMXYUIk3vEGi6+ZYUUxZfCq3fE1n4HderJb/L9apQYsS7QNyFEpmI989UvA1snykJDw7ahbz0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582554201; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=R2Zl4dz32I7WrsEdCbrwjfN57azbVU07ttCQJmZN7Fk=; b=E8bA8lCVM1uxnqsIB0Aqz/YggWxsGLkSL++zUIT2E1w9ZPmqGF+yUnCrkkV4fiY8T9NpmNYURG206sH8i105/WSFW9JHHOeSooRfwnh04pqkJJxZBOgDPluCDapt1ZHz+B465QE1gEuzMrSXtauf/6pKqB0tn33k2N711TgWlyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 158255420101416.032483848024754; Mon, 24 Feb 2020 06:23:21 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6Ecr-0007rG-1b; Mon, 24 Feb 2020 14:22:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6Ecp-0007rB-Q8 for xen-devel@lists.xenproject.org; Mon, 24 Feb 2020 14:22:23 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1255f274-5711-11ea-a490-bc764e2007e4; Mon, 24 Feb 2020 14:22:22 +0000 (UTC) X-Inumbo-ID: 1255f274-5711-11ea-a490-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1582554142; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=D3PTEokV3P1nGTzp4QXhPH5TsIlx02sVQf+cswffQ5U=; b=c6r9kHX2gjip9F6lxkCN9EWvHJnKVJdHqL/Mh/WHa/PVJL624pMT4RS8 EvsM9l1k/Mbr2S/DISr2fnKLrMnQBToU6AGCRJ7adtqBdBpYAxC4ADUqJ BqR60f2D71ZwtwInnlxmv3BGsujtdfcO5bJeUAf635NzoITynQAWMCB0Y M=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: Yo0veVn7g8uSJ4qM3xbXcXUKPHsfo5tvtyDU9nss3VgpCPUAgH8tw5cFr9d9asFyZczIdoA7Xe oT0HZMDjD8EYH4yn2YtKqt4kgSnDmYOMYFyLZc4eOznSEXZAUT6WqyDDVWBFQTW/lDlEGMfHy9 KulO1OKMN1gEcmkHmuPS2kghNXhx6phPL9jTw7D7JygVPI2ax00O78xYP4EMpdoNEDq99M6j3E vLWhDFAiiZYxwU4eODJlE7Zw4T40aXx5zcwJcheTAxyHHXR6r8cvQ4rODTXeluWK1svbB5i4QN 8ls= X-SBRS: 2.7 X-MesageID: 13265437 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,480,1574139600"; d="scan'208";a="13265437" From: Andrew Cooper To: Xen-devel Date: Mon, 24 Feb 2020 14:22:19 +0000 Message-ID: <20200224142219.30690-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] xen/xmalloc Unify type handling in macros X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The macros in xmalloc.h are a mix of using their type parameter directly, a= nd using typeof(). Switch uniformly to the latter so expressions can be used, rather than only type names. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 --- xen/include/xen/xmalloc.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/include/xen/xmalloc.h b/xen/include/xen/xmalloc.h index f515ceee2a..6ef466b13f 100644 --- a/xen/include/xen/xmalloc.h +++ b/xen/include/xen/xmalloc.h @@ -10,8 +10,11 @@ */ =20 /* Allocate space for typed object. */ -#define xmalloc(_type) ((_type *)_xmalloc(sizeof(_type), __alignof__(_type= ))) -#define xzalloc(_type) ((_type *)_xzalloc(sizeof(_type), __alignof__(_type= ))) +#define xmalloc(_type) \ + ((typeof(_type) *)_xmalloc(sizeof(_type), __alignof__(_type))) + +#define xzalloc(_type) \ + ((typeof(_type) *)_xzalloc(sizeof(_type), __alignof__(_type))) =20 /* * Allocate space for a typed object and copy an existing instance. @@ -31,16 +34,16 @@ =20 /* Allocate space for array of typed objects. */ #define xmalloc_array(_type, _num) \ - ((_type *)_xmalloc_array(sizeof(_type), __alignof__(_type), _num)) + ((typeof(_type) *)_xmalloc_array(sizeof(_type), __alignof__(_type), _n= um)) #define xzalloc_array(_type, _num) \ - ((_type *)_xzalloc_array(sizeof(_type), __alignof__(_type), _num)) + ((typeof(_type) *)_xzalloc_array(sizeof(_type), __alignof__(_type), _n= um)) =20 /* Allocate space for a structure with a flexible array of typed objects. = */ #define xzalloc_flex_struct(type, field, nr) \ - ((type *)_xzalloc(offsetof(type, field[nr]), __alignof__(type))) + ((typeof(type) *)_xzalloc(offsetof(type, field[nr]), __alignof__(type)= )) =20 #define xmalloc_flex_struct(type, field, nr) \ - ((type *)_xmalloc(offsetof(type, field[nr]), __alignof__(type))) + ((typeof(type) *)_xmalloc(offsetof(type, field[nr]), __alignof__(type)= )) =20 /* Re-allocate space for a structure with a flexible array of typed object= s. */ #define xrealloc_flex_struct(ptr, field, nr) \ --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel