From patchwork Thu Aug 12 17:50:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 61636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 443FAB70CD for ; Fri, 13 Aug 2010 03:52:12 +1000 (EST) Received: from localhost ([127.0.0.1]:36893 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ojbwn-0005hw-3S for incoming@patchwork.ozlabs.org; Thu, 12 Aug 2010 13:52:09 -0400 Received: from [140.186.70.92] (port=43183 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OjbvK-0005gH-Ry for qemu-devel@nongnu.org; Thu, 12 Aug 2010 13:50:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OjbvJ-0002bx-On for qemu-devel@nongnu.org; Thu, 12 Aug 2010 13:50:38 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:38068) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OjbvJ-0002Ym-IY for qemu-devel@nongnu.org; Thu, 12 Aug 2010 13:50:37 -0400 Received: by mail-qy0-f173.google.com with SMTP id 33so1858216qyk.4 for ; Thu, 12 Aug 2010 10:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=Pn1U9QArDMI3DxW9w37ncHMEl6WqY1vxE/e3xnt3vxQ=; b=M22D2DQF7yY3k9axVcEF7+rfIknXwwzj5I0u9VojmUrY98dVo7BYLiOwOU/M2DiDQG We6+OhxgxpWoUVYEk95OKKuSXo979xaahH44ZR8cX1es+X+TjEwUCvyMGse9Kxa6gfls yFC9tC4xclamBs71VLqulsnlbGOYoaLXoypq4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=arJzxe3oktbwr89vVCtdy5Ww1csB1kUAWPIFqMpmF9/z8kv67uNxon2ZEH3be6rzPI DSwHJDW/aeLjps4A+DaLBkDGMxXRSsznVe/ctmssyL3zrqJy10S9d2WGPlIv+/A+bAS9 lSP5uhZZNiFUVcBFd5VH6L90bFSyTJhe94opQ= Received: by 10.224.53.35 with SMTP id k35mr205380qag.250.1281635437195; Thu, 12 Aug 2010 10:50:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.241.15 with HTTP; Thu, 12 Aug 2010 10:50:17 -0700 (PDT) From: Blue Swirl Date: Thu, 12 Aug 2010 17:50:17 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 3/5] CODING_STYLE: add memory management rules X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add memory management rules, somewhat like libvirt HACKING. Signed-off-by: Blue Swirl --- CODING_STYLE | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/CODING_STYLE b/CODING_STYLE index 3f10d72..085c86f 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -148,3 +148,11 @@ up-front that this is a read-only pointer. Perhaps more importantly, if we're diligent about this, when you see a non-const pointer, you're guaranteed that it is used to modify the storage it points to, or it is aliased to another pointer that is. + + +7. Low level memory management + +Use of the malloc/free/realloc/calloc APIs is not allowed in the QEMU +codebase. Instead of these routines, use the replacement +qemu_malloc/qemu_mallocz/qemu_realloc/qemu_free or +qemu_vmalloc/qemu_memalign/qemu_vfree APIs.