From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107071 invoked by alias); 11 Jan 2017 16:14:09 -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 106959 invoked by uid 89); 11 Jan 2017 16:14:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=harm 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; Wed, 11 Jan 2017 16:14:06 +0000 Received: by simark.ca (Postfix, from userid 33) id 68DB81E851; Wed, 11 Jan 2017 11:14:04 -0500 (EST) To: Jerome Guitton Subject: Re: [RFA] completion in command definition 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: Wed, 11 Jan 2017 16:14:00 -0000 From: Simon Marchi Cc: gdb-patches@sourceware.org In-Reply-To: <20170111160518.GH27546@adacore.com> References: <1484058481-6378-1-git-send-email-guitton@adacore.com> <81874bfd1c99e89162b98d18fa8cb385@polymtl.ca> <20170111160518.GH27546@adacore.com> Message-ID: <677c2a720f77b21fd672c24efc41c878@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.2.3 X-IsSubscribed: yes X-SW-Source: 2017-01/txt/msg00190.txt.bz2 On 2017-01-11 11:05, Jerome Guitton wrote: >> >+ struct cmd_list_element *last_line = 0; >> >> This should be either "= NULL" or "= nullptr", but actually I don't >> think it needs to be initialized. > > lookup_cmd_1 does not set this parameter when it is initialized > to NULL. However, the name of the variable was a thinko. I changed it > to "result_list". Actually, I think you are confusing pointer and pointee. lookup_cmd_1 checks if result_list is NULL, not if *result_list is NULL. So with your version, since result_list is not NULL (&last_line is not NULL, it's the address of the variable) lookup_cmd_1 will set the last_line variable. There's no harm, but since we don't care about that value it's not useful either. I think what you want is: cmd = lookup_cmd_1 (&cmd_name, cmdlist, NULL, 1); Thanks, Simon