Bump liberty
This commit is contained in:
34
zyklonb.c
34
zyklonb.c
@@ -509,7 +509,7 @@ irc_establish_connection (struct bot_context *ctx,
|
||||
|
||||
static int g_signal_pipe[2]; ///< A pipe used to signal... signals
|
||||
|
||||
static struct str_vector
|
||||
static struct strv
|
||||
g_original_argv, ///< Original program arguments
|
||||
g_recovery_env; ///< Environment for re-exec recovery
|
||||
|
||||
@@ -684,8 +684,8 @@ recovery_handler (int signum, siginfo_t *info, void *context)
|
||||
static void
|
||||
prepare_recovery_environment (void)
|
||||
{
|
||||
str_vector_init (&g_recovery_env);
|
||||
str_vector_add_vector (&g_recovery_env, environ);
|
||||
strv_init (&g_recovery_env);
|
||||
strv_append_vector (&g_recovery_env, environ);
|
||||
|
||||
// Prepare a location within the environment where we will put the startup
|
||||
// (or maybe rather restart) reason in case of an irrecoverable error.
|
||||
@@ -702,7 +702,7 @@ prepare_recovery_environment (void)
|
||||
else
|
||||
{
|
||||
g_startup_reason_location = g_recovery_env.vector + g_recovery_env.len;
|
||||
str_vector_add (&g_recovery_env, "");
|
||||
strv_append (&g_recovery_env, "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -964,7 +964,7 @@ on_plugin_readable (const struct pollfd *fd, struct plugin *plugin)
|
||||
struct str *buf = &plugin->read_buffer;
|
||||
while (true)
|
||||
{
|
||||
str_ensure_space (buf, 512 + 1);
|
||||
str_reserve (buf, 512 + 1);
|
||||
ssize_t n_read = read (fd->fd, buf->str + buf->len,
|
||||
buf->alloc - buf->len - 1);
|
||||
|
||||
@@ -1173,8 +1173,8 @@ plugin_load_all_from_config (struct bot_context *ctx)
|
||||
if (!plugin_list)
|
||||
return;
|
||||
|
||||
struct str_vector plugins;
|
||||
str_vector_init (&plugins);
|
||||
struct strv plugins;
|
||||
strv_init (&plugins);
|
||||
|
||||
cstr_split (plugin_list, ",", true, &plugins);
|
||||
for (size_t i = 0; i < plugins.len; i++)
|
||||
@@ -1189,7 +1189,7 @@ plugin_load_all_from_config (struct bot_context *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
str_vector_free (&plugins);
|
||||
strv_free (&plugins);
|
||||
}
|
||||
|
||||
// --- Main program ------------------------------------------------------------
|
||||
@@ -1214,13 +1214,13 @@ parse_bot_command (const char *s, const char *command, const char **following)
|
||||
}
|
||||
|
||||
static void
|
||||
split_bot_command_argument_list (const char *arguments, struct str_vector *out)
|
||||
split_bot_command_argument_list (const char *arguments, struct strv *out)
|
||||
{
|
||||
cstr_split (arguments, ",", true, out);
|
||||
for (size_t i = 0; i < out->len; )
|
||||
{
|
||||
if (!*cstr_strip_in_place (out->vector[i], " \t"))
|
||||
str_vector_remove (out, i);
|
||||
strv_remove (out, i);
|
||||
else
|
||||
i++;
|
||||
}
|
||||
@@ -1367,8 +1367,8 @@ process_privmsg (struct bot_context *ctx, const struct irc_message *msg)
|
||||
return;
|
||||
|
||||
const char *following;
|
||||
struct str_vector list;
|
||||
str_vector_init (&list);
|
||||
struct strv list;
|
||||
strv_init (&list);
|
||||
|
||||
if (parse_bot_command (text, "quote", &following))
|
||||
// This seems to replace tons of random stupid commands
|
||||
@@ -1408,7 +1408,7 @@ process_privmsg (struct bot_context *ctx, const struct irc_message *msg)
|
||||
process_plugin_unload (ctx, msg, list.vector[i]);
|
||||
}
|
||||
|
||||
str_vector_free (&list);
|
||||
strv_free (&list);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1646,7 +1646,7 @@ on_irc_readable (const struct pollfd *fd, struct bot_context *ctx)
|
||||
bool disconnected = false;
|
||||
while (true)
|
||||
{
|
||||
str_ensure_space (buf, 512);
|
||||
str_reserve (buf, 512);
|
||||
switch (fill_buffer (ctx, buf))
|
||||
{
|
||||
case IRC_READ_AGAIN:
|
||||
@@ -1967,8 +1967,8 @@ on_signal_pipe_readable (const struct pollfd *fd, struct bot_context *ctx)
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
str_vector_init (&g_original_argv);
|
||||
str_vector_add_vector (&g_original_argv, argv);
|
||||
strv_init (&g_original_argv);
|
||||
strv_append_vector (&g_original_argv, argv);
|
||||
|
||||
static const struct opt opts[] =
|
||||
{
|
||||
@@ -2056,7 +2056,7 @@ main (int argc, char *argv[])
|
||||
poller_run (&ctx.poller);
|
||||
|
||||
bot_context_free (&ctx);
|
||||
str_vector_free (&g_original_argv);
|
||||
strv_free (&g_original_argv);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user