Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 42988 invoked from network); 26 Nov 2005 04:18:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Nov 2005 04:18:36 -0000 Received: (qmail 57726 invoked by uid 500); 26 Nov 2005 04:18:35 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 56906 invoked by uid 500); 26 Nov 2005 04:18:32 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 56895 invoked by uid 99); 26 Nov 2005 04:18:32 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Nov 2005 20:18:32 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [216.193.197.226] (HELO gs3.inmotionhosting.com) (216.193.197.226) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Nov 2005 20:20:03 -0800 Received: from c66-235-49-126.sea2.cablespeed.com ([66.235.49.126]:55733 helo=[192.168.1.100]) by gs3.inmotionhosting.com with esmtpsa (TLSv1:RC4-SHA:128) (Exim 4.52) id 1EfrVx-0008Mi-Ss for dev@httpd.apache.org; Fri, 25 Nov 2005 20:18:18 -0800 Mime-Version: 1.0 (Apple Message framework v746.2) In-Reply-To: References: Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <6BFBC08C-7068-4E2A-B0D4-8D89CDCF5817@apache.org> Content-Transfer-Encoding: 7bit From: Brian Pane Subject: Re: Cleanup in 'server/mpm/fdqueue.c' Date: Fri, 25 Nov 2005 20:18:51 -0800 To: dev@httpd.apache.org X-Mailer: Apple Mail (2.746.2) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gs3.inmotionhosting.com X-AntiAbuse: Original Domain - httpd.apache.org X-AntiAbuse: Originator/Caller UID/GID - [0 0] / [47 12] X-AntiAbuse: Sender Address Domain - apache.org X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Nov 21, 2005, at 1:34 PM, Christophe Jaillet wrote: > Around line 61 in function ap_queue_info_create, in 'server/mpm/ > fdqueue.c' > > the following sequence can cleaned-up : > =============================== > qi = apr_palloc(pool, sizeof(*qi)); > memset(qi, 0, sizeof(*qi)); > =============================== > > by using a 'apr_pcalloc' : > =============================== > qi = apr_pcalloc(pool, sizeof(*qi)); > =============================== I think the usual reason that the apr_palloc+memset pattern is used instead of apr_pcalloc in httpd and APR code is to allow the compiler generate inline code to fill the structure with zeros. gcc, for example, will apply this optimization if the struct is small. If the struct is large, gcc will generate a call to memset. With an apr_palloc call, the compiler doesn't have enough information to apply the optimization. But in the case of this particular code, which only gets called once, we really don't need the optimization. Brian