From patchwork Mon Jul 23 21:12:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lawrence Crowl X-Patchwork-Id: 172748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id A63572C0331 for ; Tue, 24 Jul 2012 07:12:55 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343682776; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=Jpy9c22 pQJP41Qaa/q1LJ7qo1/g=; b=e6qVVWZZfKsuQXq3k0Su8xpAAVUSg42fx8P9ZMh qe4UHWgeDa47fSU/bhGEpdyW7JOEbopZ89zRq/Os7ME7QoRmZAK3NE9ZS5Y6zMss U4gVEOXLjcKi2DpB1o6BH8rPpH5ktSn2FnI3sN1EFoWPbc5JQnc9nhqiviBH+2fE ePN0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=AZrKYOK6/mpcOmrus+b2rR22jEF2mvn6fWMfO/XDerN7FHjBhUHOaBOgfN/6uW wyF5w/i4B/ciTjTlr1BJs4w6naV/+9GSccsa/lVMa1tLUfFb+fNa9y2KIBKw7+d+ 3U5gYf5VF010X+1Jow99PYLGdTDs5tEHGQXgtDxW4TFHI=; Received: (qmail 18041 invoked by alias); 23 Jul 2012 21:12:51 -0000 Received: (qmail 18027 invoked by uid 22791); 23 Jul 2012 21:12:48 -0000 X-SWARE-Spam-Status: No, hits=-4.0 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD, URIBL_DBL_REDIR X-Spam-Check-By: sourceware.org Received: from mail-vc0-f201.google.com (HELO mail-vc0-f201.google.com) (209.85.220.201) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 23 Jul 2012 21:12:33 +0000 Received: by vcbfo13 with SMTP id fo13so773239vcb.2 for ; Mon, 23 Jul 2012 14:12:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=TORWNHKiMZtF6YMQpx9WHl16K63ynbi+M446lsV11Eo=; b=ZzB1mDaptIoF8OHMGiZ3F+ufXmiT3tTuEIO0veFRglmUzTXbZCrIke90xuxoUu00r/ BG32qsA5RzAyV/xJPdy9FTALr93ARtvInQJ+Qg1vjPoEw4rIO3LsztrRuMPq7+r795sj 9CrVFl1GE8PwqJO+SeQwgBmebd+8a4YzQV9xkFwl2qY6VCXMByrCve9NZ++1IjZYgFeI O8JWZo0aAN8poE86YAepe60gGrF7v5kTX+NYMZEI6KZBad/TM7wuaMpSQ082YKIyGdUJ ic0zWYZagdfcILXlZp7Xka8aIQNB3FCJz5TzUNM+tJ6t099B84Jh7HxHRx8xO9SjhY92 3Nwg== Received: by 10.101.6.16 with SMTP id j16mr2242331ani.0.1343077952493; Mon, 23 Jul 2012 14:12:32 -0700 (PDT) Received: by 10.101.6.16 with SMTP id j16mr2242325ani.0.1343077952416; Mon, 23 Jul 2012 14:12:32 -0700 (PDT) Received: from wpzn3.hot.corp.google.com (216-239-44-65.google.com [216.239.44.65]) by gmr-mx.google.com with ESMTPS id q2si3913024yhi.5.2012.07.23.14.12.32 (version=TLSv1/SSLv3 cipher=AES128-SHA); Mon, 23 Jul 2012 14:12:32 -0700 (PDT) Received: from jade.mtv.corp.google.com (jade.mtv.corp.google.com [172.18.110.116]) by wpzn3.hot.corp.google.com (Postfix) with ESMTP id 412CC100047; Mon, 23 Jul 2012 14:12:32 -0700 (PDT) Received: by jade.mtv.corp.google.com (Postfix, from userid 21482) id D6F352226D3; Mon, 23 Jul 2012 14:12:31 -0700 (PDT) To: reply@codereview.appspotmail.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [cxx-conversion] Update hash-table to new coding conventions. (Part 2) (issue6435049) Message-Id: <20120723211231.D6F352226D3@jade.mtv.corp.google.com> Date: Mon, 23 Jul 2012 14:12:31 -0700 (PDT) From: crowl@google.com (Lawrence Crowl) X-Gm-Message-State: ALoCoQlogreTJHaGltl0VoNtqc/4+NMF97swwXQUO6bdjGgQHuJyG3LtHL3U8gUv1e8q5cWUlMXGArj47PtjvZuHu8rawuc5pm6GQ3im8vQTjp8IvV2oVX98GYbhuu4jks0ZbPilDGkJQrzRYP2f26M/jGCfnLxIMZYab83vmWsyZZu2LGJLQnXmsVkJsUZ1lGxIj3n0h9Q3 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Change new C++ code to follow the new C++ coding conventions. This patch is part two, which changes the spacing for the bodies of methods formerly defined in-class. The two-part approach makes diffs sensible. --- This patch is available for review at http://codereview.appspot.com/6435049 Index: gcc/ChangeLog.cxx-conversion 2012-07-23 Lawrence Crowl * hash-table.h (xcallocator::control_alloc): Adjust spacing. (xcallocator::data_alloc): Likewise. (xcallocator::control_free): Likewise. (xcallocator::data_free): Likewise. (hash_table::hash_table): Likewise. (hash_table::is_created): Likewise. (hash_table::find): Likewise. (hash_table::find_slot): Likewise. (hash_table::remove_elt): Likewise. (hash_table::size): Likewise. (hash_table::elements): Likewise. (hash_table::collisions): Likewise. Index: gcc/hash-table.h =================================================================== --- gcc/hash-table.h (revision 189791) +++ gcc/hash-table.h (working copy) @@ -43,36 +43,44 @@ struct xcallocator }; - /* Allocate memory for COUNT control blocks. */ +/* Allocate memory for COUNT control blocks. */ template inline Type * xcallocator ::control_alloc (size_t count) - { return static_cast (xcalloc (count, sizeof (Type))); } +{ + return static_cast (xcalloc (count, sizeof (Type))); +} - /* Allocate memory for COUNT data blocks. */ +/* Allocate memory for COUNT data blocks. */ template inline Type * xcallocator ::data_alloc (size_t count) - { return static_cast (xcalloc (count, sizeof (Type))); } +{ + return static_cast (xcalloc (count, sizeof (Type))); +} - /* Free memory for control blocks. */ +/* Free memory for control blocks. */ template inline void xcallocator ::control_free (Type *memory) - { return ::free (memory); } +{ + return ::free (memory); +} - /* Free memory for data blocks. */ +/* Free memory for data blocks. */ template inline void xcallocator ::data_free (Type *memory) - { return ::free (memory); } +{ + return ::free (memory); +} /* A common function for hashing a CANDIDATE typed pointer. */ @@ -234,7 +242,7 @@ public: }; - /* Construct the hash table. The only useful operation next is create. */ +/* Construct the hash table. The only useful operation next is create. */ template class Allocator> inline hash_table ::hash_table () - : htab (NULL) - { - } +: htab (NULL) +{ +} - /* See if the table has been created, as opposed to constructed. */ +/* See if the table has been created, as opposed to constructed. */ template class Allocator> inline bool hash_table ::is_created () - { - return htab != NULL; - } +{ + return htab != NULL; +} - /* Like find_with_hash, but compute the hash value from the element. */ +/* Like find_with_hash, but compute the hash value from the element. */ template class Allocator> inline Element * hash_table ::find (Element *comparable) - { - return find_with_hash (comparable, Hash (comparable)); - } +{ + return find_with_hash (comparable, Hash (comparable)); +} - /* Like find_slot_with_hash, but compute the hash value from the element. */ +/* Like find_slot_with_hash, but compute the hash value from the element. */ template ::find_slot (Element *comparable, enum insert_option insert) - { - return find_slot_with_hash (comparable, Hash (comparable), insert); - } +{ + return find_slot_with_hash (comparable, Hash (comparable), insert); +} - /* Like remove_elt_with_hash, but compute the hash value from the element. */ +/* Like remove_elt_with_hash, but compute the hash value from the element. */ template ::remove_elt (Element *comparable) - { - remove_elt_with_hash (comparable, Hash (comparable)); - } - +{ + remove_elt_with_hash (comparable, Hash (comparable)); +} - /* Return the current size of this hash table. */ +/* Return the current size of this hash table. */ template class Allocator> inline size_t hash_table ::size() - { - return htab->size; - } +{ + return htab->size; +} - /* Return the current number of elements in this hash table. */ +/* Return the current number of elements in this hash table. */ template class Allocator> inline size_t hash_table ::elements() - { - return htab->n_elements - htab->n_deleted; - } +{ + return htab->n_elements - htab->n_deleted; +} /* Return the fraction of fixed collisions during all work with given @@ -345,12 +352,12 @@ template class Allocator> inline double hash_table ::collisions() - { - if (htab->searches == 0) - return 0.0; +{ + if (htab->searches == 0) + return 0.0; - return static_cast (htab->collisions) / htab->searches; - } + return static_cast (htab->collisions) / htab->searches; +} /* Create a hash table with at least the given number of INITIAL_SLOTS. */