removing the useless +1's on sizeof() and adding the mail_parameter for the

getquot inside the imap_get_quotaroot function.  thank Jani.
This commit is contained in:
Dan Kalowsky 2002-07-31 01:03:31 +00:00
parent 38757032d2
commit 7f30227181
2 changed files with 8 additions and 12 deletions

View file

@ -391,8 +391,8 @@ void mail_getquota(MAILSTREAM *stream, char *qroot, QUOTALIST *qlist)
return; return;
} }
add_assoc_long_ex(t_map, "usage", sizeof("usage")+1, qlist->usage); add_assoc_long_ex(t_map, "usage", sizeof("usage"), qlist->usage);
add_assoc_long_ex(t_map, "limit", sizeof("limit")+1, qlist->limit); add_assoc_long_ex(t_map, "limit", sizeof("limit"), qlist->limit);
add_assoc_zval_ex(IMAPG(quota_return), qlist->name, strlen(qlist->name)+1, t_map); add_assoc_zval_ex(IMAPG(quota_return), qlist->name, strlen(qlist->name)+1, t_map);
} }
} }
@ -408,9 +408,9 @@ void mail_getquotaroot(MAILSTREAM *stream, char *mbx, STRINGLIST *qroot)
{ {
TSRMLS_FETCH(); TSRMLS_FETCH();
add_next_index_stringl(IMAPG(quota_return), mbx, strlen(mbx)+1, 1); add_next_index_stringl(IMAPG(quota_return), mbx, strlen(mbx), 1);
for(; qroot; qroot = qroot->next) { for(; qroot; qroot = qroot->next) {
add_next_index_stringl(IMAPG(quota_return), qroot->text.data, qroot->text.size+1, 1); add_next_index_stringl(IMAPG(quota_return), qroot->text.data, qroot->text.size, 1);
} }
} }
@ -442,7 +442,6 @@ static void php_imap_init_globals(zend_imap_globals *imap_globals)
imap_globals->folderlist_style = FLIST_ARRAY; imap_globals->folderlist_style = FLIST_ARRAY;
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
imap_globals->quota_return = NULL; imap_globals->quota_return = NULL;
imap_globals->quotaroot_return = NULL;
#endif #endif
} }
/* }}} */ /* }}} */
@ -1093,9 +1092,7 @@ PHP_FUNCTION(imap_get_quota)
} }
*return_value = *IMAPG(quota_return); *return_value = *IMAPG(quota_return);
//FREE_ZVAL(IMAPG(quota_return)); FREE_ZVAL(IMAPG(quota_return));
//IMAPG(quota_return) = NULL;
} }
/* }}} */ /* }}} */
@ -1122,15 +1119,15 @@ PHP_FUNCTION(imap_get_quotaroot)
} }
/* set the callback for the GET_QUOTAROOT function */ /* set the callback for the GET_QUOTAROOT function */
mail_parameters(NIL, SET_QUOTA, (void *) mail_getquota);
mail_parameters(NIL, SET_QUOTAROOT, (void *) mail_getquotaroot); mail_parameters(NIL, SET_QUOTAROOT, (void *) mail_getquotaroot);
if(!imap_getquotaroot(imap_le_struct->imap_stream, Z_STRVAL_PP(mbox))) { if(!imap_getquotaroot(imap_le_struct->imap_stream, Z_STRVAL_PP(mbox))) {
php_error(E_WARNING, "c-client imap_getquotaroot failed"); php_error(E_WARNING, "%s(): c-client imap_getquotaroot failed", get_active_function_name(TSRMLS_C));
RETURN_FALSE; RETURN_FALSE;
} }
*return_value = *IMAPG(quota_return); *return_value = *IMAPG(quota_return);
//FREE_ZVAL(IMAPG(quota_return)); FREE_ZVAL(IMAPG(quota_return));
//IMAPG(quotaroot_return) = NULL;
} }
/* }}} */ /* }}} */

View file

@ -211,7 +211,6 @@ ZEND_BEGIN_MODULE_GLOBALS(imap)
unsigned long status_uidvalidity; unsigned long status_uidvalidity;
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001) #if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
zval *quota_return; zval *quota_return;
zval *quotaroot_return;
#endif #endif
ZEND_END_MODULE_GLOBALS(imap) ZEND_END_MODULE_GLOBALS(imap)