Code cleanup
This commit is contained in:
parent
1917629193
commit
75b61ff69d
|
@ -394,12 +394,13 @@ static IMAP4Command * _imap4_command(IMAP4 * imap4, IMAP4Context context,
|
||||||
(void *)imap4->channel);
|
(void *)imap4->channel);
|
||||||
#endif
|
#endif
|
||||||
/* abort if the command is invalid */
|
/* abort if the command is invalid */
|
||||||
if(command == NULL || (len = strlen(command) + 9) == 0)
|
if(command == NULL || (len = strlen(command)) == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* abort if there is no active connection */
|
/* abort if there is no active connection */
|
||||||
if(imap4->channel == NULL)
|
if(imap4->channel == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* queue the command */
|
/* queue the command */
|
||||||
|
len += 9;
|
||||||
if((p = realloc(imap4->queue, sizeof(*p) * (imap4->queue_cnt + 1)))
|
if((p = realloc(imap4->queue, sizeof(*p) * (imap4->queue_cnt + 1)))
|
||||||
== NULL)
|
== NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -346,7 +346,7 @@ static POP3Command * _pop3_command(POP3 * pop3, POP3Context context,
|
||||||
if(pop3->channel == NULL)
|
if(pop3->channel == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
/* queue the command */
|
/* queue the command */
|
||||||
len += 2;
|
len += 3;
|
||||||
if((p = realloc(pop3->queue, sizeof(*p) * (pop3->queue_cnt + 1)))
|
if((p = realloc(pop3->queue, sizeof(*p) * (pop3->queue_cnt + 1)))
|
||||||
== NULL)
|
== NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -354,9 +354,9 @@ static POP3Command * _pop3_command(POP3 * pop3, POP3Context context,
|
||||||
p = &pop3->queue[pop3->queue_cnt];
|
p = &pop3->queue[pop3->queue_cnt];
|
||||||
p->context = context;
|
p->context = context;
|
||||||
p->status = P3CS_QUEUED;
|
p->status = P3CS_QUEUED;
|
||||||
if((p->buf = malloc(len + 1)) == NULL)
|
if((p->buf = malloc(len)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
p->buf_cnt = snprintf(p->buf, len + 1, "%s\r\n", command);
|
p->buf_cnt = snprintf(p->buf, len, "%s\r\n", command);
|
||||||
memset(&p->data, 0, sizeof(p->data));
|
memset(&p->data, 0, sizeof(p->data));
|
||||||
if(pop3->queue_cnt++ == 0)
|
if(pop3->queue_cnt++ == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user