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:
Robert Shearman 2008-07-09 22:29:01 +01:00 committed by Junio C Hamano
parent 684ec6c63c
commit 95c539081e

View File

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