From: Timo Sirainen Date: Fri, 28 Oct 2016 14:00:13 +0000 (+0300) Subject: lib-program-client: Fix building with compilers that have no typeof() X-Git-Tag: 2.2.26.0~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b4c7a5309f4c1ca73f68ab95ec7f3b549e77696;p=thirdparty%2Fdovecot%2Fcore.git lib-program-client: Fix building with compilers that have no typeof() --- diff --git a/src/lib-program-client/test-program-client-remote.c b/src/lib-program-client/test-program-client-remote.c index a37abe7f7f..8530e5e675 100644 --- a/src/lib-program-client/test-program-client-remote.c +++ b/src/lib-program-client/test-program-client-remote.c @@ -141,27 +141,28 @@ static void test_program_run(struct test_client *client) { int ret; - const char *arg; + const char *const *args; + unsigned int count; const unsigned char *data; size_t siz; timeout_remove(&test_globals.to); - test_assert(array_count(&client->args) > 0); - arg = *array_idx(&client->args, 0); - if (strcmp(arg, "test_program_success")==0) { + args = array_get(&client->args, &count); + test_assert(count > 0); + if (strcmp(args[0], "test_program_success")==0) { /* return hello world */ + test_assert(count >= 3); o_stream_nsend_str(client->out, t_strdup_printf("%s %s\n+\n", - *array_idx(&client->args, 1), - *array_idx(&client->args, 2))); - } else if (strcmp(arg, "test_program_io")==0) { + args[1], args[2])); + } else if (strcmp(args[0], "test_program_io")==0) { do { data = i_stream_get_data(client->body, &siz); o_stream_nsend(client->out, data, siz); i_stream_skip(client->body, siz); } while((ret = i_stream_read(client->body))>0); o_stream_nsend_str(client->out, "+\n"); - } else if (strcmp(arg, "test_program_failure")==0) { + } else if (strcmp(args[0], "test_program_failure")==0) { o_stream_nsend_str(client->out, "-\n"); } test_program_client_destroy(&client);