From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60566 invoked by alias); 16 Apr 2017 05:09:41 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 60182 invoked by uid 89); 16 Apr 2017 05:09:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy= X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Apr 2017 05:09:35 +0000 Received: by simark.ca (Postfix, from userid 33) id 9B4F61E4A1; Sun, 16 Apr 2017 01:09:35 -0400 (EDT) To: Sergio Durigan Junior Subject: Re: [PATCH v2] C++ify gdb/common/environ.c X-PHP-Originating-Script: 33:rcube.php MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 16 Apr 2017 05:09:00 -0000 From: Simon Marchi Cc: GDB Patches In-Reply-To: <20170415185053.31827-1-sergiodj@redhat.com> References: <20170413040455.23996-1-sergiodj@redhat.com> <20170415185053.31827-1-sergiodj@redhat.com> Message-ID: <7da1e54fc8f25b39e1e4c9558a77e71a@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.4 X-IsSubscribed: yes X-SW-Source: 2017-04/txt/msg00483.txt.bz2 On 2017-04-15 14:50, Sergio Durigan Junior wrote: > As part of the preparation necessary for my upcoming task, I'd like to > propose that we turn gdb_environ into a class. The approach taken > here is simple: the class gdb_environ contains everything that is > needed to manipulate the environment variables. These variables are > stored in two data structures: an unordered_set, good because lookups > are O(n), and an std::vector, which can be converted to a > 'char **' and passed as argument to functions that need it. Forgot to mention (probably a typo) that lookups in the map are O(1) on average. If they were O(n), it wouldn't be better than looking up in a vector :). At least that's what it says here: [1] http://en.cppreference.com/w/cpp/container/unordered_map/at Simon