From owner-svn-src-head@freebsd.org Tue Feb 21 00:03:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7872CCE5B4A; Tue, 21 Feb 2017 00:03:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 17BE21505; Tue, 21 Feb 2017 00:03:20 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-wm0-f47.google.com with SMTP id v186so94661342wmd.0; Mon, 20 Feb 2017 16:03:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to:cc; bh=9EA9fL2/8Z0n2F7eiW0ZhUxBd++LxKkJAg1hSHsuQdg=; b=eyr7CAlF3WHJ0Q+iYQQoYZP7yRUSSt7bTJ1Wk3DVzmgg6YZ1ofT53s4nH5g2Z5ZZUz eihkYW1vYrHDXAUxQJb/leKKZfABia8aRyvLCaISMpilgXEEsMXHGGymRjEO5Wa/nvb/ GTQkac4vSM6EHJv2etvXfldqiRksyV1HrzyAKs738ICuE6Kg3Vqd/OFWNLLgAO7g50nx aLoibDdO1EGV/yT35Fu9CRG6m/tBm/7Gkrlhitt5Bx3ByQp7odaTvFVktuAKaHl8jMHn hV7uE5BUOv5dbc7wfdbwfD4L1mzeTWppao2kRP080Jej33S33dNnxznE8VUnkAjOHu9j CuyA== X-Gm-Message-State: AMke39nJtGjntR3xY/Faqlj3Np8ESyrlzu9ytTviRhrswFS9wviGJ5Z/GPEniNBYrwdCJA== X-Received: by 10.28.55.199 with SMTP id e190mr20632734wma.92.1487634031543; Mon, 20 Feb 2017 15:40:31 -0800 (PST) Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com. [209.85.128.176]) by smtp.gmail.com with ESMTPSA id m83sm15310629wmc.33.2017.02.20.15.40.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Feb 2017 15:40:31 -0800 (PST) Received: by mail-wr0-f176.google.com with SMTP id 89so68164367wrr.3; Mon, 20 Feb 2017 15:40:31 -0800 (PST) X-Received: by 10.223.145.163 with SMTP id 32mr19335882wri.198.1487634031306; Mon, 20 Feb 2017 15:40:31 -0800 (PST) MIME-Version: 1.0 Reply-To: cem@freebsd.org Received: by 10.80.152.82 with HTTP; Mon, 20 Feb 2017 15:40:30 -0800 (PST) In-Reply-To: <201702200343.v1K3hCk3060716@repo.freebsd.org> References: <201702200343.v1K3hCk3060716@repo.freebsd.org> From: Conrad Meyer Date: Mon, 20 Feb 2017 15:40:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r313982 - in head/sys/dev: agp al_eth an arcmsr bce beri/virtio bhnd/cores/usb buslogic ce cm cp ctau cx de ed fatm fe firewire hptiop hptmv iicbus isp le md ncr netmap ofw patm pccard ... To: "Pedro F. Giffuni" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Feb 2017 00:03:21 -0000 On Sun, Feb 19, 2017 at 7:43 PM, Pedro F. Giffuni wrote: > Author: pfg > Date: Mon Feb 20 03:43:12 2017 > New Revision: 313982 > URL: https://svnweb.freebsd.org/changeset/base/313982 > > Log: > sys/dev: Replace zero with NULL for pointers. > > Makes things easier to read, plus architectures may set NULL to something > different than zero. Hi Pedro, I like the change for style reasons. The comment about architectures with non-zero NULL is a little misleading, though. This change has no impact on non-zero bit pattern NULL architectures. The zero pointer value in C is NULL and NULL is the zero pointer value in C. It may have a bit pattern other than zero (i.e., printf("%p", NULL) may be non-zero and memset(&p, 0, sizeof(p)) is bogus in portable code) but assigning the logical zero value is always legitimate. After all, NULL is just a casted zero value: #define NULL ((void *)0) Maybe this is moot. I don't believe any architecture FreeBSD actually supports has non-zero bitpattern NULL, but something weird like CHERI might. Best, Conrad