Skip to content

Commit

Permalink
cmd/snap-confine: make sc_args helpers const-correct
Browse files Browse the repository at this point in the history
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
  • Loading branch information
zyga committed Mar 11, 2019
1 parent 0a961c1 commit f6a589d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions cmd/snap-confine/snap-confine-args.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,39 +214,39 @@ void sc_cleanup_args(struct sc_args **ptr)
*ptr = NULL;
}

bool sc_args_is_version_query(struct sc_args *args)
bool sc_args_is_version_query(const struct sc_args *args)
{
if (args == NULL) {
die("cannot obtain version query flag from NULL argument parser");
}
return args->is_version_query;
}

bool sc_args_is_classic_confinement(struct sc_args * args)
bool sc_args_is_classic_confinement(const struct sc_args * args)
{
if (args == NULL) {
die("cannot obtain classic confinement flag from NULL argument parser");
}
return args->is_classic_confinement;
}

const char *sc_args_security_tag(struct sc_args *args)
const char *sc_args_security_tag(const struct sc_args *args)
{
if (args == NULL) {
die("cannot obtain security tag from NULL argument parser");
}
return args->security_tag;
}

const char *sc_args_executable(struct sc_args *args)
const char *sc_args_executable(const struct sc_args *args)
{
if (args == NULL) {
die("cannot obtain executable from NULL argument parser");
}
return args->executable;
}

const char *sc_args_base_snap(struct sc_args *args)
const char *sc_args_base_snap(const struct sc_args *args)
{
if (args == NULL) {
die("cannot obtain base snap name from NULL argument parser");
Expand Down
10 changes: 5 additions & 5 deletions cmd/snap-confine/snap-confine-args.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ void sc_cleanup_args(struct sc_args **ptr);
/**
* Check if snap-confine was invoked with the --version switch.
**/
bool sc_args_is_version_query(struct sc_args *args);
bool sc_args_is_version_query(const struct sc_args *args);

/**
* Check if snap-confine was invoked with the --classic switch.
**/
bool sc_args_is_classic_confinement(struct sc_args *args);
bool sc_args_is_classic_confinement(const struct sc_args *args);

/**
* Get the security tag passed to snap-confine.
Expand All @@ -100,7 +100,7 @@ bool sc_args_is_classic_confinement(struct sc_args *args);
* The return value must not be freed(). It is bound to the lifetime of
* the argument parser.
**/
const char *sc_args_security_tag(struct sc_args *args);
const char *sc_args_security_tag(const struct sc_args *args);

/**
* Get the executable name passed to snap-confine.
Expand All @@ -111,14 +111,14 @@ const char *sc_args_security_tag(struct sc_args *args);
* The return value must not be freed(). It is bound to the lifetime of
* the argument parser.
**/
const char *sc_args_executable(struct sc_args *args);
const char *sc_args_executable(const struct sc_args *args);

/**
* Get the name of the base snap to use.
*
* The return value must not be freed(). It is bound to the lifetime of
* the argument parser.
**/
const char *sc_args_base_snap(struct sc_args *args);
const char *sc_args_base_snap(const struct sc_args *args);

#endif

0 comments on commit f6a589d

Please sign in to comment.