Skip to content

Commit

Permalink
dof_parser: a bit of const-correctness
Browse files Browse the repository at this point in the history
dof_parser_host_write does not change its dh argument, so make it const.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed Feb 22, 2024
1 parent 12144eb commit 12ed428
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libcommon/dof_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ typedef struct dof_parsed {
*
* Returns 0 on success or a positive errno value on error.
*/
int dof_parser_host_write(int out, dof_helper_t *dh, dof_hdr_t *dof);
int dof_parser_host_write(int out, const dof_helper_t *dh, dof_hdr_t *dof);

/*
* Read a single DOF structure from a parser pipe. Wait at most TIMEOUT seconds
Expand Down
8 changes: 4 additions & 4 deletions libcommon/dof_parser_host.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Oracle Linux DTrace; DOF-consumption and USDT-probe-creation daemon.
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
Expand Down Expand Up @@ -51,15 +51,15 @@ dof_parser_write_one(int out, const void *buf_, size_t size)
* Returns 0 on success or a positive errno value on error.
*/
int
dof_parser_host_write(int out, dof_helper_t *dh, dof_hdr_t *dof)
dof_parser_host_write(int out, const dof_helper_t *dh, dof_hdr_t *dof)
{
int err;

if ((err = dof_parser_write_one(out, (char *)dh,
if ((err = dof_parser_write_one(out, (const char *)dh,
sizeof(dof_helper_t))) < 0)
return err;

return dof_parser_write_one(out, (char *)dof,
return dof_parser_write_one(out, (const char *)dof,
dof->dofh_loadsz);
}

Expand Down

0 comments on commit 12ed428

Please sign in to comment.