imap-send.c: style fixes
Signed-off-by: Robert Shearman <robertshearman@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
684ec6c63c
commit
95c539081e
111
imap-send.c
111
imap-send.c
@ -240,8 +240,7 @@ static void ssl_socket_perror(const char *func)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
socket_perror( const char *func, Socket_t *sock, int ret )
|
||||
static void socket_perror(const char *func, Socket_t *sock, int ret)
|
||||
{
|
||||
#ifndef NO_OPENSSL
|
||||
if (sock->ssl) {
|
||||
@ -318,8 +317,7 @@ static int ssl_socket_connect(Socket_t *sock, int use_tls_only, int verify)
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
socket_read( Socket_t *sock, char *buf, int len )
|
||||
static int socket_read(Socket_t *sock, char *buf, int len)
|
||||
{
|
||||
ssize_t n;
|
||||
#ifndef NO_OPENSSL
|
||||
@ -336,8 +334,7 @@ socket_read( Socket_t *sock, char *buf, int len )
|
||||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
socket_write( Socket_t *sock, const char *buf, int len )
|
||||
static int socket_write(Socket_t *sock, const char *buf, int len)
|
||||
{
|
||||
int n;
|
||||
#ifndef NO_OPENSSL
|
||||
@ -366,8 +363,7 @@ static void socket_shutdown(Socket_t *sock)
|
||||
}
|
||||
|
||||
/* simple line buffering */
|
||||
static int
|
||||
buffer_gets( buffer_t * b, char **s )
|
||||
static int buffer_gets(buffer_t * b, char **s)
|
||||
{
|
||||
int n;
|
||||
int start = b->offset;
|
||||
@ -416,8 +412,7 @@ buffer_gets( buffer_t * b, char **s )
|
||||
/* not reached */
|
||||
}
|
||||
|
||||
static void
|
||||
imap_info( const char *msg, ... )
|
||||
static void imap_info(const char *msg, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
||||
@ -429,8 +424,7 @@ imap_info( const char *msg, ... )
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
imap_warn( const char *msg, ... )
|
||||
static void imap_warn(const char *msg, ...)
|
||||
{
|
||||
va_list va;
|
||||
|
||||
@ -441,8 +435,7 @@ imap_warn( const char *msg, ... )
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
next_arg( char **s )
|
||||
static char *next_arg(char **s)
|
||||
{
|
||||
char *ret;
|
||||
|
||||
@ -472,8 +465,7 @@ next_arg( char **s )
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
free_generic_messages( message_t *msgs )
|
||||
static void free_generic_messages(message_t *msgs)
|
||||
{
|
||||
message_t *tmsg;
|
||||
|
||||
@ -483,8 +475,7 @@ free_generic_messages( message_t *msgs )
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
nfsnprintf( char *buf, int blen, const char *fmt, ... )
|
||||
static int nfsnprintf(char *buf, int blen, const char *fmt, ...)
|
||||
{
|
||||
int ret;
|
||||
va_list va;
|
||||
@ -500,8 +491,7 @@ static struct {
|
||||
unsigned char i, j, s[256];
|
||||
} rs;
|
||||
|
||||
static void
|
||||
arc4_init( void )
|
||||
static void arc4_init(void)
|
||||
{
|
||||
int i, fd;
|
||||
unsigned char j, si, dat[128];
|
||||
@ -530,8 +520,7 @@ arc4_init( void )
|
||||
arc4_getbyte();
|
||||
}
|
||||
|
||||
static unsigned char
|
||||
arc4_getbyte( void )
|
||||
static unsigned char arc4_getbyte(void)
|
||||
{
|
||||
unsigned char si, sj;
|
||||
|
||||
@ -544,8 +533,8 @@ arc4_getbyte( void )
|
||||
return rs.s[(si + sj) & 0xff];
|
||||
}
|
||||
|
||||
static struct imap_cmd *
|
||||
v_issue_imap_cmd( imap_store_t *ctx, struct imap_cmd_cb *cb,
|
||||
static struct imap_cmd *v_issue_imap_cmd(imap_store_t *ctx,
|
||||
struct imap_cmd_cb *cb,
|
||||
const char *fmt, va_list ap)
|
||||
{
|
||||
imap_t *imap = ctx->imap;
|
||||
@ -606,8 +595,9 @@ v_issue_imap_cmd( imap_store_t *ctx, struct imap_cmd_cb *cb,
|
||||
return cmd;
|
||||
}
|
||||
|
||||
static struct imap_cmd *
|
||||
issue_imap_cmd( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt, ... )
|
||||
static struct imap_cmd *issue_imap_cmd(imap_store_t *ctx,
|
||||
struct imap_cmd_cb *cb,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
struct imap_cmd *ret;
|
||||
va_list ap;
|
||||
@ -618,8 +608,8 @@ issue_imap_cmd( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt, ...
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
imap_exec( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt, ... )
|
||||
static int imap_exec(imap_store_t *ctx, struct imap_cmd_cb *cb,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
struct imap_cmd *cmdp;
|
||||
@ -633,8 +623,8 @@ imap_exec( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt, ... )
|
||||
return get_cmd_result(ctx, cmdp);
|
||||
}
|
||||
|
||||
static int
|
||||
imap_exec_m( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt, ... )
|
||||
static int imap_exec_m(imap_store_t *ctx, struct imap_cmd_cb *cb,
|
||||
const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
struct imap_cmd *cmdp;
|
||||
@ -652,20 +642,17 @@ imap_exec_m( imap_store_t *ctx, struct imap_cmd_cb *cb, const char *fmt, ... )
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
is_atom( list_t *list )
|
||||
static int is_atom(list_t *list)
|
||||
{
|
||||
return list && list->val && list->val != NIL && list->val != LIST;
|
||||
}
|
||||
|
||||
static int
|
||||
is_list( list_t *list )
|
||||
static int is_list(list_t *list)
|
||||
{
|
||||
return list && list->val == LIST;
|
||||
}
|
||||
|
||||
static void
|
||||
free_list( list_t *list )
|
||||
static void free_list(list_t *list)
|
||||
{
|
||||
list_t *tmp;
|
||||
|
||||
@ -679,8 +666,7 @@ free_list( list_t *list )
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
parse_imap_list_l( imap_t *imap, char **sp, list_t **curp, int level )
|
||||
static int parse_imap_list_l(imap_t *imap, char **sp, list_t **curp, int level)
|
||||
{
|
||||
list_t *cur;
|
||||
char *s = *sp, *p;
|
||||
@ -772,8 +758,7 @@ parse_imap_list_l( imap_t *imap, char **sp, list_t **curp, int level )
|
||||
return -1;
|
||||
}
|
||||
|
||||
static list_t *
|
||||
parse_imap_list( imap_t *imap, char **sp )
|
||||
static list_t *parse_imap_list(imap_t *imap, char **sp)
|
||||
{
|
||||
list_t *head;
|
||||
|
||||
@ -783,14 +768,12 @@ parse_imap_list( imap_t *imap, char **sp )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static list_t *
|
||||
parse_list( char **sp )
|
||||
static list_t *parse_list(char **sp)
|
||||
{
|
||||
return parse_imap_list(NULL, sp);
|
||||
}
|
||||
|
||||
static void
|
||||
parse_capability( imap_t *imap, char *cmd )
|
||||
static void parse_capability(imap_t *imap, char *cmd)
|
||||
{
|
||||
char *arg;
|
||||
unsigned i;
|
||||
@ -803,8 +786,8 @@ parse_capability( imap_t *imap, char *cmd )
|
||||
imap->rcaps = imap->caps;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_response_code( imap_store_t *ctx, struct imap_cmd_cb *cb, char *s )
|
||||
static int parse_response_code(imap_store_t *ctx, struct imap_cmd_cb *cb,
|
||||
char *s)
|
||||
{
|
||||
imap_t *imap = ctx->imap;
|
||||
char *arg, *p;
|
||||
@ -847,8 +830,7 @@ parse_response_code( imap_store_t *ctx, struct imap_cmd_cb *cb, char *s )
|
||||
return RESP_OK;
|
||||
}
|
||||
|
||||
static int
|
||||
get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
|
||||
static int get_cmd_result(imap_store_t *ctx, struct imap_cmd *tcmd)
|
||||
{
|
||||
imap_t *imap = ctx->imap;
|
||||
struct imap_cmd *cmdp, **pcmdp, *ncmdp;
|
||||
@ -975,8 +957,7 @@ get_cmd_result( imap_store_t *ctx, struct imap_cmd *tcmd )
|
||||
/* not reached */
|
||||
}
|
||||
|
||||
static void
|
||||
imap_close_server( imap_store_t *ictx )
|
||||
static void imap_close_server(imap_store_t *ictx)
|
||||
{
|
||||
imap_t *imap = ictx->imap;
|
||||
|
||||
@ -990,16 +971,14 @@ imap_close_server( imap_store_t *ictx )
|
||||
free(imap);
|
||||
}
|
||||
|
||||
static void
|
||||
imap_close_store( store_t *ctx )
|
||||
static void imap_close_store(store_t *ctx)
|
||||
{
|
||||
imap_close_server((imap_store_t *)ctx);
|
||||
free_generic_messages(ctx->msgs);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
static store_t *
|
||||
imap_open_store( imap_server_conf_t *srvc )
|
||||
static store_t *imap_open_store(imap_server_conf_t *srvc)
|
||||
{
|
||||
imap_store_t *ctx;
|
||||
imap_t *imap;
|
||||
@ -1155,8 +1134,7 @@ imap_open_store( imap_server_conf_t *srvc )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int
|
||||
imap_make_flags( int flags, char *buf )
|
||||
static int imap_make_flags(int flags, char *buf)
|
||||
{
|
||||
const char *s;
|
||||
unsigned i, d;
|
||||
@ -1175,8 +1153,7 @@ imap_make_flags( int flags, char *buf )
|
||||
|
||||
#define TUIDL 8
|
||||
|
||||
static int
|
||||
imap_store_msg( store_t *gctx, msg_data_t *data, int *uid )
|
||||
static int imap_store_msg(store_t *gctx, msg_data_t *data, int *uid)
|
||||
{
|
||||
imap_store_t *ctx = (imap_store_t *)gctx;
|
||||
imap_t *imap = ctx->imap;
|
||||
@ -1290,8 +1267,7 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int *uid )
|
||||
|
||||
#define CHUNKSIZE 0x1000
|
||||
|
||||
static int
|
||||
read_message( FILE *f, msg_data_t *msg )
|
||||
static int read_message(FILE *f, msg_data_t *msg)
|
||||
{
|
||||
struct strbuf buf;
|
||||
|
||||
@ -1308,8 +1284,7 @@ read_message( FILE *f, msg_data_t *msg )
|
||||
return msg->len;
|
||||
}
|
||||
|
||||
static int
|
||||
count_messages( msg_data_t *msg )
|
||||
static int count_messages(msg_data_t *msg)
|
||||
{
|
||||
int count = 0;
|
||||
char *p = msg->data;
|
||||
@ -1327,8 +1302,7 @@ count_messages( msg_data_t *msg )
|
||||
return count;
|
||||
}
|
||||
|
||||
static int
|
||||
split_msg( msg_data_t *all_msgs, msg_data_t *msg, int *ofs )
|
||||
static int split_msg(msg_data_t *all_msgs, msg_data_t *msg, int *ofs)
|
||||
{
|
||||
char *p, *data;
|
||||
|
||||
@ -1359,8 +1333,7 @@ split_msg( msg_data_t *all_msgs, msg_data_t *msg, int *ofs )
|
||||
return 1;
|
||||
}
|
||||
|
||||
static imap_server_conf_t server =
|
||||
{
|
||||
static imap_server_conf_t server = {
|
||||
NULL, /* name */
|
||||
NULL, /* tunnel */
|
||||
NULL, /* host */
|
||||
@ -1373,8 +1346,7 @@ static imap_server_conf_t server =
|
||||
|
||||
static char *imap_folder;
|
||||
|
||||
static int
|
||||
git_imap_config(const char *key, const char *val, void *cb)
|
||||
static int git_imap_config(const char *key, const char *val, void *cb)
|
||||
{
|
||||
char imap_key[] = "imap.";
|
||||
|
||||
@ -1412,8 +1384,7 @@ git_imap_config(const char *key, const char *val, void *cb)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
msg_data_t all_msgs, msg;
|
||||
store_t *ctx = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user