From owner-freebsd-net@FreeBSD.ORG Sat Feb 23 00:16:13 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4566316A400 for ; Sat, 23 Feb 2008 00:16:13 +0000 (UTC) (envelope-from ithilgore.fbsd@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.152]) by mx1.freebsd.org (Postfix) with ESMTP id D241A13C478 for ; Sat, 23 Feb 2008 00:16:12 +0000 (UTC) (envelope-from ithilgore.fbsd@gmail.com) Received: by fg-out-1718.google.com with SMTP id 16so449156fgg.35 for ; Fri, 22 Feb 2008 16:16:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; bh=TOUs506GgpKYbnlLymFDtKLoY9IYBrMOnE+jw4KqjeQ=; b=qevAzLz3y70Pl/lxv+uBn+w6ORhJlPuGyV80RNtYNEbWZq2itiUJijmPe1d3/mjNuaTGjY2I5AaoPuarFsVNetakpsp7DHlTGVmSiFY+C6a9G41jAqGrsICsEyldVaJii05I0pFoGbbP2r6z2sCMgazTj+jgjY5Wihxu2vxfW7s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:content-type:content-transfer-encoding; b=KhI6W89lCSPRDxNswX8TuYdoj3j/tnyf2e9D4ShQi2fSuhxzv7g7XIIOxtuytutEQC1nFb2MKsQc7JwAnS+f4MiEDUqgPUjYmzDSWlWVIGp9r6Ma7EH/7x1bgSXnhbcYeiD7GUZodPsArp0qOOcrAjiE3b6Vh1fFwxJGlCKeQw8= Received: by 10.86.60.15 with SMTP id i15mr615547fga.36.1203725771505; Fri, 22 Feb 2008 16:16:11 -0800 (PST) Received: from ?10.0.0.12? ( [62.1.229.152]) by mx.google.com with ESMTPS id 12sm2464629fgg.6.2008.02.22.16.16.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 22 Feb 2008 16:16:10 -0800 (PST) Message-ID: <47BFF17B.5080205@gmail.com> Date: Sat, 23 Feb 2008 02:12:11 -0800 From: ithilgore User-Agent: Thunderbird 2.0.0.9 (X11/20071212) MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: question about change in inet_ntoa.c X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Feb 2008 00:16:13 -0000 I was looking at the differences between some old FreeBSD code and the one of 7.0-RC1 and was wondering about a change in inet_ntoa.c /***** 7.0-RC1 **************/ sprintf(buf, "%d.%d.%d.%d", ucp[0] & 0xff, ucp[1] & 0xff, ucp[2] & 0xff, ucp[3] & 0xff); /****** 4.11-RELEASE ***********/ static const char fmt[] = "%u.%u.%u%u"; if ((size_t)snprintf(dst, size, fmt, src[0], src[1], src[2], src[3]) >= size) { .... .... Was there a specific purpose of changing the more easy and simple way of %u instead of the combination of %d and and-ing with 0xff ?? It essentially gives the same result but increases overhead (i think) in the more recent version.