Skip to content

Commit

Permalink
lib-program-client: Whitespace fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse committed Oct 19, 2016
1 parent 867b2e2 commit 1be27c3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 25 deletions.
15 changes: 10 additions & 5 deletions src/lib-program-client/program-client-local.c
Expand Up @@ -38,14 +38,16 @@ struct program_client_local {
};

static
void program_client_local_waitchild(const struct child_wait_status *, struct program_client_local *);
void program_client_local_waitchild(const struct child_wait_status *,
struct program_client_local *);
static
void program_client_local_disconnect(struct program_client *pclient, bool force);
static
void program_client_local_exited(struct program_client_local *slclient);

static
void exec_child(const char *bin_path, const char *const *args, const char *const *envs,
void exec_child(const char *bin_path, const char *const *args,
const char *const *envs,
int in_fd, int out_fd, int *extra_fds, bool drop_stderr)
{
ARRAY_TYPE(const_string) exec_args;
Expand Down Expand Up @@ -155,7 +157,8 @@ void program_client_local_waitchild(const struct child_wait_status *status,
static
int program_client_local_connect(struct program_client *pclient)
{
struct program_client_local *slclient = (struct program_client_local *) pclient;
struct program_client_local *slclient =
(struct program_client_local *)pclient;
int fd_in[2] = { -1, -1 }, fd_out[2] = {-1, -1};
struct program_client_extra_fd *efds = NULL;
int *parent_extra_fds = NULL, *child_extra_fds = NULL;
Expand Down Expand Up @@ -280,8 +283,10 @@ int program_client_local_connect(struct program_client *pclient)

program_client_init_streams(pclient);

slclient->child_wait = child_wait_new_with_pid(slclient->pid, program_client_local_waitchild,
slclient);
slclient->child_wait =
child_wait_new_with_pid(slclient->pid,
program_client_local_waitchild,
slclient);
return program_client_connected(pclient);
}

Expand Down
9 changes: 6 additions & 3 deletions src/lib-program-client/program-client-private.h
Expand Up @@ -65,14 +65,17 @@ struct program_client {
bool output_dot_created:1;
};

void program_client_init(struct program_client *pclient, pool_t pool, const char *path,
const char *const *args, const struct program_client_settings *set);
void program_client_init(struct program_client *pclient, pool_t pool,
const char *path,
const char *const *args,
const struct program_client_settings *set);

void program_client_init_streams(struct program_client *pclient);

int program_client_connected(struct program_client *pclient);

void program_client_fail(struct program_client *pclient, enum program_client_error error);
void program_client_fail(struct program_client *pclient,
enum program_client_error error);

void program_client_program_input(struct program_client *pclient);

Expand Down
5 changes: 2 additions & 3 deletions src/lib-program-client/program-client-remote.c
Expand Up @@ -23,8 +23,6 @@
PROGRAM_CLIENT_VERSION_MAJOR "\t" \
PROGRAM_CLIENT_VERSION_MINOR "\n"



static
void program_client_net_connect_again(struct program_client *pclient);

Expand Down Expand Up @@ -224,7 +222,8 @@ void program_client_remote_connected(struct program_client *pclient)
if (!slclient->noreply) {
struct istream *is = pclient->program_input;
pclient->program_input =
program_client_istream_create(pclient, pclient->program_input);
program_client_istream_create(pclient,
pclient->program_input);
i_stream_unref(&is);
}

Expand Down
34 changes: 23 additions & 11 deletions src/lib-program-client/program-client.c
Expand Up @@ -21,7 +21,8 @@
#define MAX_OUTPUT_MEMORY_BUFFER (1024*128)

static
void program_client_callback(struct program_client *pclient, int result, void *context)
void program_client_callback(struct program_client *pclient, int result, void
*context)
{
program_client_callback_t *callback = pclient->callback;
i_assert(pclient->callback != NULL);
Expand Down Expand Up @@ -179,7 +180,8 @@ void program_client_disconnect(struct program_client *pclient, bool force)
pclient->disconnect(pclient, force);
}

void program_client_fail(struct program_client *pclient, enum program_client_error error)
void program_client_fail(struct program_client *pclient,
enum program_client_error error)
{
if (pclient->error != PROGRAM_CLIENT_ERROR_NONE)
return;
Expand Down Expand Up @@ -443,8 +445,10 @@ int program_client_connected(struct program_client *pclient)
return ret;
}

void program_client_init(struct program_client *pclient, pool_t pool, const char *path,
const char *const *args, const struct program_client_settings *set)
void program_client_init(struct program_client *pclient, pool_t pool,
const char *path,
const char *const *args,
const struct program_client_settings *set)
{
pclient->pool = pool;
pclient->path = p_strdup(pool, path);
Expand All @@ -456,7 +460,8 @@ void program_client_init(struct program_client *pclient, pool_t pool, const char
pclient->fd_out = -1;
}

void program_client_set_input(struct program_client *pclient, struct istream *input)
void program_client_set_input(struct program_client *pclient,
struct istream *input)
{
if (pclient->input != NULL)
i_stream_unref(&pclient->input);
Expand All @@ -465,7 +470,8 @@ void program_client_set_input(struct program_client *pclient, struct istream *in
pclient->input = input;
}

void program_client_set_output(struct program_client *pclient, struct ostream *output)
void program_client_set_output(struct program_client *pclient,
struct ostream *output)
{
if (pclient->output != NULL)
o_stream_unref(&pclient->output);
Expand All @@ -476,7 +482,8 @@ void program_client_set_output(struct program_client *pclient, struct ostream *o
i_free(pclient->temp_prefix);
}

void program_client_set_output_seekable(struct program_client *pclient, const char *temp_prefix)
void program_client_set_output_seekable(struct program_client *pclient,
const char *temp_prefix)
{
if (pclient->output != NULL)
o_stream_unref(&pclient->output);
Expand All @@ -496,7 +503,8 @@ struct istream *program_client_get_output_seekable(struct program_client *pclien

#undef program_client_set_extra_fd
void program_client_set_extra_fd(struct program_client *pclient, int fd,
program_client_fd_callback_t *callback, void *context)
program_client_fd_callback_t *callback,
void *context)
{
struct program_client_extra_fd *efds;
struct program_client_extra_fd *efd = NULL;
Expand Down Expand Up @@ -524,7 +532,8 @@ void program_client_set_extra_fd(struct program_client *pclient, int fd,
efd->context = context;
}

void program_client_set_env(struct program_client *pclient, const char *name, const char *value)
void program_client_set_env(struct program_client *pclient, const char *name,
const char *value)
{
const char *env;

Expand Down Expand Up @@ -566,7 +575,8 @@ void program_client_init_streams(struct program_client *pclient)
t_strdup_printf("program output fd=%d",
efds[i].child_fd));
efds[i].io = io_add(efds[i].parent_fd, IO_READ,
program_client_extra_fd_input, &efds[i]);
program_client_extra_fd_input,
&efds[i]);
}
}
}
Expand Down Expand Up @@ -687,7 +697,9 @@ int program_client_run(struct program_client *pclient)
}

#undef program_client_run_async
void program_client_run_async(struct program_client *pclient, program_client_callback_t *callback, void *context)
void program_client_run_async(struct program_client *pclient,
program_client_callback_t *callback,
void *context)
{
int ret;

Expand Down
7 changes: 4 additions & 3 deletions src/lib-program-client/program-client.h
Expand Up @@ -75,10 +75,11 @@ void program_client_set_env(struct program_client *pclient,
/* Since script service cannot return system exit code, the exit value shall be
-1, 0, or 1. -1 is internal error, 0 is failure and 1 is success */
int program_client_run(struct program_client *pclient);
void program_client_run_async(struct program_client *pclient, program_client_callback_t *, void*);
void program_client_run_async(struct program_client *pclient,
program_client_callback_t *, void*);
#define program_client_run_async(pclient, callback, context) \
program_client_run_async(pclient, (program_client_callback_t*)callback, (char*)context + \
CALLBACK_TYPECHECK(callback, \
program_client_run_async(pclient, (program_client_callback_t*)callback, \
(char*)context + CALLBACK_TYPECHECK(callback, \
void (*)(int, typeof(context))))

#endif

0 comments on commit 1be27c3

Please sign in to comment.