aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/msg.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-04-29 16:08:37 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-04-29 16:08:37 +0200
commit35c0333a09cee6c6f7d72e6c2459110a65d51a3d (patch)
tree1ce971a5d02ad13d7da571bedf7ef715605a3b86 /src/msg.c
parentnet: use size instead of length for variable names (diff)
downloadcimple-35c0333a09cee6c6f7d72e6c2459110a65d51a3d.tar.gz
cimple-35c0333a09cee6c6f7d72e6c2459110a65d51a3d.zip
make struct ci_queue_entry opaque
Diffstat (limited to '')
-rw-r--r--src/msg.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/msg.c b/src/msg.c
index 5e18681..0c8dfc7 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -15,13 +15,13 @@
int msg_success(struct msg *msg)
{
- char *argv[] = {"success", NULL};
+ const char *argv[] = {"success", NULL};
return msg_from_argv(msg, argv);
}
int msg_error(struct msg *msg)
{
- char *argv[] = {"error", NULL};
+ const char *argv[] = {"error", NULL};
return msg_from_argv(msg, argv);
}
@@ -35,9 +35,9 @@ int msg_is_error(const struct msg *msg)
return msg->argc == 1 && !strcmp(msg->argv[0], "error");
}
-static int msg_copy_argv(struct msg *msg, char **argv)
+static int msg_copy_argv(struct msg *msg, const char **argv)
{
- msg->argv = calloc(msg->argc, sizeof(char *));
+ msg->argv = calloc(msg->argc, sizeof(const char *));
if (!msg->argv) {
log_errno("calloc");
@@ -72,7 +72,7 @@ struct msg *msg_copy(const struct msg *src)
}
dest->argc = src->argc;
- ret = msg_copy_argv(dest, src->argv);
+ ret = msg_copy_argv(dest, (const char **)src->argv);
if (ret < 0)
goto free;
@@ -91,11 +91,11 @@ void msg_free(const struct msg *msg)
free(msg->argv);
}
-int msg_from_argv(struct msg *msg, char **argv)
+int msg_from_argv(struct msg *msg, const char **argv)
{
int argc = 0;
- for (char **s = argv; *s; ++s)
+ for (const char **s = argv; *s; ++s)
++argc;
msg->argc = argc;