Skip to content

Commit 5019d3d

Browse files
author
foobar
committed
Made use of the resource macros here too. And some beutifying.
1 parent 6da0268 commit 5019d3d

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

ext/imap/php_imap.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function_entry imap_functions[] = {
132132
#if defined(HAVE_IMAP2000) || defined(HAVE_IMAP2001)
133133
PHP_FE(imap_get_quota, NULL)
134134
PHP_FE(imap_set_quota, NULL)
135-
PHP_FE(imap_setacl, NULL)
135+
PHP_FE(imap_setacl, NULL)
136136
#endif
137137

138138
#ifndef PHP_WIN32
@@ -1066,30 +1066,22 @@ PHP_FUNCTION(imap_set_quota)
10661066
PHP_FUNCTION(imap_setacl)
10671067
{
10681068
zval **streamind, **mailbox, **id, **rights;
1069-
int ind, ind_type;
10701069
pils *imap_le_struct;
1071-
1070+
10721071
if (ZEND_NUM_ARGS() != 4 || zend_get_parameters_ex(4, &streamind, &mailbox, &id, &rights) == FAILURE) {
10731072
ZEND_WRONG_PARAM_COUNT();
10741073
}
10751074

1076-
convert_to_long_ex(streamind);
1075+
ZEND_FETCH_RESOURCE(imap_le_struct, pils *, streamind, -1, "imap", le_imap);
1076+
10771077
convert_to_string_ex(mailbox);
1078-
convert_to_string_ex(id);
10791078
convert_to_string_ex(rights);
10801079

1081-
ind = Z_LVAL_PP(streamind);
1082-
imap_le_struct = (pils *) zend_list_find(ind, &ind_type);
1083-
if (!imap_le_struct || !IS_STREAM(ind_type)) {
1084-
php_error(E_WARNING, "Unable to find stream pointer");
1085-
RETURN_FALSE;
1086-
}
1087-
10881080
RETURN_LONG(imap_setacl(imap_le_struct->imap_stream, Z_STRVAL_PP(mailbox), Z_STRVAL_PP(id), Z_STRVAL_PP(rights)));
10891081
}
10901082
/* }}} */
10911083

1092-
#endif
1084+
#endif /* HAVE_IMAP2000 || HAVE_IMAP2001 */
10931085

10941086

10951087
/* {{{ proto int imap_expunge(int stream_id)

0 commit comments

Comments
 (0)