mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-09 05:54:47 +02:00
Sync OpenBSD patchset 640:
Use the array.h code for the causes list.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: cmd-source-file.c,v 1.12 2010-02-08 18:10:07 tcunha Exp $ */
|
||||
/* $Id: cmd-source-file.c,v 1.13 2010-02-08 18:29:32 tcunha Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Tiago Cunha <me@tiagocunha.org>
|
||||
@ -89,18 +89,18 @@ int
|
||||
cmd_source_file_exec(struct cmd *self, struct cmd_ctx *ctx)
|
||||
{
|
||||
struct cmd_source_file_data *data = self->data;
|
||||
char **causes;
|
||||
u_int i, ncauses;
|
||||
struct causelist causes;
|
||||
char *cause;
|
||||
u_int i;
|
||||
|
||||
causes = NULL;
|
||||
ncauses = 0;
|
||||
|
||||
if (load_cfg(data->path, ctx, &ncauses, &causes) != 0) {
|
||||
for (i = 0; i < ncauses; i++) {
|
||||
ctx->print(ctx, "%s", causes[i]);
|
||||
xfree(causes[i]);
|
||||
ARRAY_INIT(&causes);
|
||||
if (load_cfg(data->path, ctx, &causes) != 0) {
|
||||
for (i = 0; i < ARRAY_LENGTH(&causes); i++) {
|
||||
cause = ARRAY_ITEM(&causes, i);
|
||||
ctx->print(ctx, "%s", cause);
|
||||
xfree(cause);
|
||||
}
|
||||
xfree(causes);
|
||||
ARRAY_FREE(&causes);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
Reference in New Issue
Block a user