From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91107 invoked by alias); 21 Sep 2017 07:02:23 -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 91036 invoked by uid 89); 21 Sep 2017 07:02:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-6.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Thursday X-HELO: mga06.intel.com Received: from mga06.intel.com (HELO mga06.intel.com) (134.134.136.31) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 21 Sep 2017 07:02:13 +0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 21 Sep 2017 00:02:10 -0700 X-ExtLoop1: 1 Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by orsmga002.jf.intel.com with ESMTP; 21 Sep 2017 00:02:09 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.248]) by IRSMSX108.ger.corp.intel.com ([169.254.11.167]) with mapi id 14.03.0319.002; Thu, 21 Sep 2017 08:02:09 +0100 From: "Metzger, Markus T" To: Tom Tromey , "gdb-patches@sourceware.org" Subject: RE: [RFA 01/67] Add add_cmd function overloads Date: Thu, 21 Sep 2017 07:02:00 -0000 Message-ID: References: <20170921051023.19023-1-tom@tromey.com> <20170921051023.19023-2-tom@tromey.com> In-Reply-To: <20170921051023.19023-2-tom@tromey.com> dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00600.txt.bz2 > -----Original Message----- > From: gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] On Behalf Of Tom Tromey > Sent: Thursday, September 21, 2017 7:09 AM > To: gdb-patches@sourceware.org > Cc: Tom Tromey > Subject: [RFA 01/67] Add add_cmd function overloads Hello Tom, > static void > +do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty) > +{ > + c->function.const_cfunc (args, from_tty); /* Ok. */ > +} Ok.? > +void > +set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfun= c) > +{ > + if (cfunc =3D=3D NULL) > + cmd->func =3D NULL; > + else > + cmd->func =3D do_const_cfunc; > + cmd->function.const_cfunc =3D cfunc; /* Ok. */ > +} We shouldn't really have the NULL case, anymore. It is still possible but= I don't expect it to be used. Should we assert CFUNC !=3D NULL? Should we also set CMD->FUNCTION.CFUNC to NULL? > @@ -229,7 +251,6 @@ add_cmd (const char *name, enum command_class > theclass, cmd_cfunc_ftype *fun, >=20 > c->name =3D name; > c->theclass =3D theclass; > - set_cmd_cfunc (c, fun); Should we instead set all the respective fields to NULL? > +struct cmd_list_element * > +add_cmd (const char *name, enum command_class theclass, > + const char *doc, struct cmd_list_element **list) > +{ > + cmd_list_element *result =3D do_add_cmd (name, theclass, doc, list); > + result->func =3D NULL; > + result->function.cfunc =3D NULL; /* Ok. */ > + return result; > +} Should we also set RESULT->FUNCTION.CONST_CFUNC to NULL? Regards, Markus. Intel Deutschland GmbH Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany Tel: +49 89 99 8853-0, www.intel.de Managing Directors: Christin Eisenschmid, Christian Lamprechter Chairperson of the Supervisory Board: Nicole Lau Registered Office: Munich Commercial Register: Amtsgericht Muenchen HRB 186928