Skip to content

Commit de46915

Browse files
author
Dan Kalowsky
committed
Revert that last change, it had code that wasn't ment to go in
1 parent 44685a9 commit de46915

File tree

1 file changed

+17
-41
lines changed

1 file changed

+17
-41
lines changed

ext/imap/php_imap.c

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -376,28 +376,13 @@ void mail_free_messagelist(MESSAGELIST **msglist, MESSAGELIST **tail)
376376
*/
377377
void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
378378
{
379-
zval *t_map;
380379
TSRMLS_FETCH();
381380

382381
/* this should only be run through once */
383382
for (; qlist; qlist = qlist->next)
384383
{
385-
MAKE_STD_ZVAL(t_map);
386-
if (array_init(t_map) == FAILURE) {
387-
php_error(E_WARNING, "Unable to allocate t_map memory");
388-
FREE_ZVAL(t_map);
389-
FREE_ZVAL(IMAPG(quota_return));
390-
return;
391-
}
392-
if (strncmp(qlist->name, "STORAGE", 7) == 0)
393-
{
394-
add_assoc_long_ex(IMAPG(quota_return), "usage", sizeof("usage"), qlist->usage);
395-
add_assoc_long_ex(IMPAG(quota_return), "limit", sizeof("limit"), qlist->limit);
396-
}
397-
398-
add_assoc_long_ex(t_map, "usage", sizeof("usage"), qlist->usage);
399-
add_assoc_long_ex(t_map, "limit", sizeof("limit"), qlist->usage);
400-
ass_assoc_zval_ex(IMAPG(quota_return), qlist->name, strlen(qlist->name)+1, t_map);
384+
IMAPG(quota_usage) = qlist->usage;
385+
IMAPG(quota_limit) = qlist->limit;
401386
}
402387
}
403388
/* }}} */
@@ -1059,23 +1044,20 @@ PHP_FUNCTION(imap_get_quota)
10591044

10601045
convert_to_string_ex(qroot);
10611046

1062-
MAKE_STD_ZVAL(IMAPG(quota_return));
1063-
if (array_init(IMAPG(quota_return)) == FAILURE) {
1064-
php_error(E_WARNING, "Unable to allocate array memory");
1065-
FREE_ZVAL(IMAPG(quota_return));
1066-
RETURN_FALSE;
1067-
}
1068-
10691047
/* set the callback for the GET_QUOTA function */
10701048
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
10711049
if(!imap_getquota(imap_le_struct->imap_stream, Z_STRVAL_PP(qroot))) {
10721050
php_error(E_WARNING, "c-client imap_getquota failed");
10731051
RETURN_FALSE;
10741052
}
10751053

1076-
*return_value = *IMAPG(quota_return);
1077-
FREE_ZVAL(IMAPG(quota_return));
1078-
1054+
if (array_init(return_value) == FAILURE) {
1055+
php_error(E_WARNING, "Unable to allocate array memory");
1056+
RETURN_FALSE;
1057+
}
1058+
1059+
add_assoc_long(return_value, "usage", IMAPG(quota_usage));
1060+
add_assoc_long(return_value, "limit", IMAPG(quota_limit));
10791061
}
10801062
/* }}} */
10811063

@@ -2218,7 +2200,7 @@ PHP_FUNCTION(imap_utf7_decode)
22182200
/* author: Andrew Skalski <askalski@chek.com> */
22192201
zval **arg;
22202202
const unsigned char *in, *inp, *endp;
2221-
unsigned char *out, *outp, c;
2203+
unsigned char *out, *outp;
22222204
int inlen, outlen;
22232205
enum {
22242206
ST_NORMAL, /* printable text */
@@ -2320,15 +2302,13 @@ PHP_FUNCTION(imap_utf7_decode)
23202302
break;
23212303
case ST_DECODE1:
23222304
outp[1] = UNB64(*inp);
2323-
c = outp[1] >> 4;
2324-
*outp++ |= c;
2305+
*outp++ |= outp[1] >> 4;
23252306
*outp <<= 4;
23262307
state = ST_DECODE2;
23272308
break;
23282309
case ST_DECODE2:
23292310
outp[1] = UNB64(*inp);
2330-
c = outp[1] >> 2;
2331-
*outp++ |= c;
2311+
*outp++ |= outp[1] >> 2;
23322312
*outp <<= 6;
23332313
state = ST_DECODE3;
23342314
break;
@@ -2361,7 +2341,7 @@ PHP_FUNCTION(imap_utf7_encode)
23612341
/* author: Andrew Skalski <askalski@chek.com> */
23622342
zval **arg;
23632343
const unsigned char *in, *inp, *endp;
2364-
unsigned char *out, *outp, c;
2344+
unsigned char *out, *outp;
23652345
int inlen, outlen;
23662346
enum {
23672347
ST_NORMAL, /* printable text */
@@ -2432,29 +2412,25 @@ PHP_FUNCTION(imap_utf7_encode)
24322412
} else if (inp == endp || !SPECIAL(*inp)) {
24332413
/* flush overflow and terminate region */
24342414
if (state != ST_ENCODE0) {
2435-
c = B64(*outp);
2436-
*outp++ = c;
2415+
*outp++ = B64(*outp);
24372416
}
24382417
*outp++ = '-';
24392418
state = ST_NORMAL;
24402419
} else {
24412420
/* encode input character */
24422421
switch (state) {
24432422
case ST_ENCODE0:
2444-
c = B64(*outp | *inp >> 4);
2445-
*outp = c;
2423+
*outp++ = B64(*inp >> 2);
24462424
*outp = *inp++ << 4;
24472425
state = ST_ENCODE1;
24482426
break;
24492427
case ST_ENCODE1:
2450-
c = B64(*outp | *inp >> 4);
2451-
*outp++ = c;
2428+
*outp++ = B64(*outp | *inp >> 4);
24522429
*outp = *inp++ << 2;
24532430
state = ST_ENCODE2;
24542431
break;
24552432
case ST_ENCODE2:
2456-
c = B64(*outp | *inp >> 6);
2457-
*outp++ = c;
2433+
*outp++ = B64(*outp | *inp >> 6);
24582434
*outp++ = B64(*inp++);
24592435
state = ST_ENCODE0;
24602436
case ST_NORMAL:

0 commit comments

Comments
 (0)