@@ -376,28 +376,13 @@ void mail_free_messagelist(MESSAGELIST **msglist, MESSAGELIST **tail)
376
376
*/
377
377
void mail_getquota (MAILSTREAM * stream , char * qroot , QUOTALIST * qlist )
378
378
{
379
- zval * t_map ;
380
379
TSRMLS_FETCH ();
381
380
382
381
/* this should only be run through once */
383
382
for (; qlist ; qlist = qlist -> next )
384
383
{
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 ;
401
386
}
402
387
}
403
388
/* }}} */
@@ -1059,23 +1044,20 @@ PHP_FUNCTION(imap_get_quota)
1059
1044
1060
1045
convert_to_string_ex (qroot );
1061
1046
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
-
1069
1047
/* set the callback for the GET_QUOTA function */
1070
1048
mail_parameters (NIL , SET_QUOTA , (void * ) mail_getquota );
1071
1049
if (!imap_getquota (imap_le_struct -> imap_stream , Z_STRVAL_PP (qroot ))) {
1072
1050
php_error (E_WARNING , "c-client imap_getquota failed" );
1073
1051
RETURN_FALSE ;
1074
1052
}
1075
1053
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 ));
1079
1061
}
1080
1062
/* }}} */
1081
1063
@@ -2218,7 +2200,7 @@ PHP_FUNCTION(imap_utf7_decode)
2218
2200
/* author: Andrew Skalski <askalski@chek.com> */
2219
2201
zval * * arg ;
2220
2202
const unsigned char * in , * inp , * endp ;
2221
- unsigned char * out , * outp , c ;
2203
+ unsigned char * out , * outp ;
2222
2204
int inlen , outlen ;
2223
2205
enum {
2224
2206
ST_NORMAL , /* printable text */
@@ -2320,15 +2302,13 @@ PHP_FUNCTION(imap_utf7_decode)
2320
2302
break ;
2321
2303
case ST_DECODE1 :
2322
2304
outp [1 ] = UNB64 (* inp );
2323
- c = outp [1 ] >> 4 ;
2324
- * outp ++ |= c ;
2305
+ * outp ++ |= outp [1 ] >> 4 ;
2325
2306
* outp <<= 4 ;
2326
2307
state = ST_DECODE2 ;
2327
2308
break ;
2328
2309
case ST_DECODE2 :
2329
2310
outp [1 ] = UNB64 (* inp );
2330
- c = outp [1 ] >> 2 ;
2331
- * outp ++ |= c ;
2311
+ * outp ++ |= outp [1 ] >> 2 ;
2332
2312
* outp <<= 6 ;
2333
2313
state = ST_DECODE3 ;
2334
2314
break ;
@@ -2361,7 +2341,7 @@ PHP_FUNCTION(imap_utf7_encode)
2361
2341
/* author: Andrew Skalski <askalski@chek.com> */
2362
2342
zval * * arg ;
2363
2343
const unsigned char * in , * inp , * endp ;
2364
- unsigned char * out , * outp , c ;
2344
+ unsigned char * out , * outp ;
2365
2345
int inlen , outlen ;
2366
2346
enum {
2367
2347
ST_NORMAL , /* printable text */
@@ -2432,29 +2412,25 @@ PHP_FUNCTION(imap_utf7_encode)
2432
2412
} else if (inp == endp || !SPECIAL (* inp )) {
2433
2413
/* flush overflow and terminate region */
2434
2414
if (state != ST_ENCODE0 ) {
2435
- c = B64 (* outp );
2436
- * outp ++ = c ;
2415
+ * outp ++ = B64 (* outp );
2437
2416
}
2438
2417
* outp ++ = '-' ;
2439
2418
state = ST_NORMAL ;
2440
2419
} else {
2441
2420
/* encode input character */
2442
2421
switch (state ) {
2443
2422
case ST_ENCODE0 :
2444
- c = B64 (* outp | * inp >> 4 );
2445
- * outp = c ;
2423
+ * outp ++ = B64 (* inp >> 2 );
2446
2424
* outp = * inp ++ << 4 ;
2447
2425
state = ST_ENCODE1 ;
2448
2426
break ;
2449
2427
case ST_ENCODE1 :
2450
- c = B64 (* outp | * inp >> 4 );
2451
- * outp ++ = c ;
2428
+ * outp ++ = B64 (* outp | * inp >> 4 );
2452
2429
* outp = * inp ++ << 2 ;
2453
2430
state = ST_ENCODE2 ;
2454
2431
break ;
2455
2432
case ST_ENCODE2 :
2456
- c = B64 (* outp | * inp >> 6 );
2457
- * outp ++ = c ;
2433
+ * outp ++ = B64 (* outp | * inp >> 6 );
2458
2434
* outp ++ = B64 (* inp ++ );
2459
2435
state = ST_ENCODE0 ;
2460
2436
case ST_NORMAL :
0 commit comments