libctf: Use const ctf_file_t references in string lookup routines

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2022-02-23 18:37:40 -05:00
parent c5d476c98c
commit 45c23c2608
2 changed files with 5 additions and 5 deletions

View File

@ -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_push(ctf_decl_t *, ctf_file_t *, ctf_id_t);
extern void ctf_decl_sprintf(ctf_decl_t *, const char *, ...); extern void ctf_decl_sprintf(ctf_decl_t *, const char *, ...);
extern const char *ctf_strraw(ctf_file_t *, uint_t); extern const char *ctf_strraw(const ctf_file_t *, uint_t);
extern const char *ctf_strptr(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 ctf_file_t *ctf_set_open_errno(int *, int);
extern long ctf_set_errno(ctf_file_t *, int); extern long ctf_set_errno(ctf_file_t *, int);

View File

@ -96,9 +96,9 @@ ctf_list_delete(ctf_list_t *lp, void *existing)
* up the appropriate string table buffer and then adding the offset. * up the appropriate string table buffer and then adding the offset.
*/ */
const char * 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) if (ctsp->cts_strs != NULL && CTF_NAME_OFFSET(name) < ctsp->cts_len)
return (ctsp->cts_strs + CTF_NAME_OFFSET(name)); return (ctsp->cts_strs + CTF_NAME_OFFSET(name));
@ -108,7 +108,7 @@ ctf_strraw(ctf_file_t *fp, uint_t name)
} }
const char * 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); const char *s = ctf_strraw(fp, name);
return (s != NULL ? s : "(?)"); return (s != NULL ? s : "(?)");