git: 2d30593c2428 - stable/13 - libctf: Use const ctf_file_t references in string lookup routines

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 02 Mar 2022 13:59:40 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=2d30593c2428417d007ae0abd995909d3413192c

commit 2d30593c2428417d007ae0abd995909d3413192c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-02-23 23:37:40 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-02 13:59:25 +0000

    libctf: Use const ctf_file_t references in string lookup routines
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 45c23c2608ec3e34b5c7ce18eca91a46419e363c)
---
 cddl/contrib/opensolaris/common/ctf/ctf_impl.h | 4 ++--
 cddl/contrib/opensolaris/common/ctf/ctf_util.c | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_impl.h b/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
index f56fa6a00548..dd6167856074 100644
--- a/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
+++ b/cddl/contrib/opensolaris/common/ctf/ctf_impl.h
@@ -305,8 +305,8 @@ extern void ctf_decl_fini(ctf_decl_t *);
 extern void ctf_decl_push(ctf_decl_t *, ctf_file_t *, ctf_id_t);
 extern void ctf_decl_sprintf(ctf_decl_t *, const char *, ...);
 
-extern const char *ctf_strraw(ctf_file_t *, uint_t);
-extern const char *ctf_strptr(ctf_file_t *, uint_t);
+extern const char *ctf_strraw(const ctf_file_t *, uint_t);
+extern const char *ctf_strptr(const ctf_file_t *, uint_t);
 
 extern ctf_file_t *ctf_set_open_errno(int *, int);
 extern long ctf_set_errno(ctf_file_t *, int);
diff --git a/cddl/contrib/opensolaris/common/ctf/ctf_util.c b/cddl/contrib/opensolaris/common/ctf/ctf_util.c
index 740d403e8c52..d3d9a65211bb 100644
--- a/cddl/contrib/opensolaris/common/ctf/ctf_util.c
+++ b/cddl/contrib/opensolaris/common/ctf/ctf_util.c
@@ -96,9 +96,9 @@ ctf_list_delete(ctf_list_t *lp, void *existing)
  * up the appropriate string table buffer and then adding the offset.
  */
 const char *
-ctf_strraw(ctf_file_t *fp, uint_t name)
+ctf_strraw(const ctf_file_t *fp, uint_t name)
 {
-	ctf_strs_t *ctsp = &fp->ctf_str[CTF_NAME_STID(name)];
+	const ctf_strs_t *ctsp = &fp->ctf_str[CTF_NAME_STID(name)];
 
 	if (ctsp->cts_strs != NULL && CTF_NAME_OFFSET(name) < ctsp->cts_len)
 		return (ctsp->cts_strs + CTF_NAME_OFFSET(name));
@@ -108,7 +108,7 @@ ctf_strraw(ctf_file_t *fp, uint_t name)
 }
 
 const char *
-ctf_strptr(ctf_file_t *fp, uint_t name)
+ctf_strptr(const ctf_file_t *fp, uint_t name)
 {
 	const char *s = ctf_strraw(fp, name);
 	return (s != NULL ? s : "(?)");