From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 7C6723864858; Thu, 7 Apr 2022 15:07:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C6723864858 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: add some const in gdb/reggroups.c X-Act-Checkin: binutils-gdb X-Git-Author: Andrew Burgess X-Git-Refname: refs/heads/master X-Git-Oldrev: 86d77f6a5be904f13c633f10bdf77ff3dd69db94 X-Git-Newrev: b5556e33b5cbe101257074c497178df6de293c3e Message-Id: <20220407150751.7C6723864858@sourceware.org> Date: Thu, 7 Apr 2022 15:07:51 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Apr 2022 15:07:51 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Db5556e33b5cb= e101257074c497178df6de293c3e commit b5556e33b5cbe101257074c497178df6de293c3e Author: Andrew Burgess Date: Wed Mar 30 15:53:42 2022 +0100 gdb: add some const in gdb/reggroups.c =20 This commit makes the 'struct reggroup *' argument const for the following functions: =20 reggroup_next reggroup_prev reggroup_name reggroup_type =20 There are other places that could benefit from const in the reggroup.{c,h} files, but these will be changing in further commits. =20 There should be no user visible changes after this commit. Diff: --- gdb/reggroups.c | 8 ++++---- gdb/reggroups.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdb/reggroups.c b/gdb/reggroups.c index b6afa2f895c..169285b7475 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -63,13 +63,13 @@ reggroup_gdbarch_new (struct gdbarch *gdbarch, const ch= ar *name, /* Register group attributes. */ =20 const char * -reggroup_name (struct reggroup *group) +reggroup_name (const struct reggroup *group) { return group->name; } =20 enum reggroup_type -reggroup_type (struct reggroup *group) +reggroup_type (const struct reggroup *group) { return group->type; } @@ -130,7 +130,7 @@ static struct reggroups default_groups =3D { NULL, &def= ault_groups.first }; /* A register group iterator. */ =20 struct reggroup * -reggroup_next (struct gdbarch *gdbarch, struct reggroup *last) +reggroup_next (struct gdbarch *gdbarch, const struct reggroup *last) { struct reggroups *groups; struct reggroup_el *el; @@ -161,7 +161,7 @@ reggroup_next (struct gdbarch *gdbarch, struct reggroup= *last) /* See reggroups.h. */ =20 struct reggroup * -reggroup_prev (struct gdbarch *gdbarch, struct reggroup *curr) +reggroup_prev (struct gdbarch *gdbarch, const struct reggroup *curr) { struct reggroups *groups; struct reggroup_el *el; diff --git a/gdb/reggroups.h b/gdb/reggroups.h index f2e60c4f1da..ef99483f39f 100644 --- a/gdb/reggroups.h +++ b/gdb/reggroups.h @@ -50,17 +50,17 @@ extern struct reggroup *reggroup_gdbarch_new (struct gd= barch *gdbarch, extern void reggroup_add (struct gdbarch *gdbarch, struct reggroup *group); =20 /* Register group attributes. */ -extern const char *reggroup_name (struct reggroup *reggroup); -extern enum reggroup_type reggroup_type (struct reggroup *reggroup); +extern const char *reggroup_name (const struct reggroup *reggroup); +extern enum reggroup_type reggroup_type (const struct reggroup *reggroup); =20 /* Iterators for the architecture's register groups. Pass in NULL, returns the first (for next), or last (for prev) group. Pass in a group, returns the next or previous group, or NULL when either the end or the beginning of the group list is reached. */ extern struct reggroup *reggroup_next (struct gdbarch *gdbarch, - struct reggroup *last); + const struct reggroup *last); extern struct reggroup *reggroup_prev (struct gdbarch *gdbarch, - struct reggroup *curr); + const struct reggroup *curr); /* Find a reggroup by name. */ extern reggroup *reggroup_find (struct gdbarch *gdbarch, const char *name);