Skip to content

Commit d8018b2

Browse files
Girgiasjorgsowa
authored andcommitted
ext/ldap: Rename variable and move closer to usage site
1 parent 7e29a97 commit d8018b2

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

ext/ldap/ldap.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2202,7 +2202,6 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
22022202
LDAPControl **lserverctrls = NULL;
22032203
ldap_resultdata *result;
22042204
LDAPMessage *ldap_res;
2205-
int i, msgid;
22062205
size_t dn_len;
22072206
int is_full_add=0; /* flag for full add operation so ldap_mod_add can be put back into oper, gerrit THomson */
22082207

@@ -2314,19 +2313,21 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
23142313
}
23152314
}
23162315

2317-
/* check flag to see if do_mod was called to perform full add , gerrit thomson */
2316+
/* check flag to see if do_mod was called to perform full add , gerrit thomson */
2317+
int ldap_status_code = LDAP_SUCCESS;
2318+
int msgid;
23182319
if (is_full_add == 1) {
23192320
if (ext) {
2320-
i = ldap_add_ext(ld->link, dn, ldap_mods, lserverctrls, NULL, &msgid);
2321+
ldap_status_code = ldap_add_ext(ld->link, dn, ldap_mods, lserverctrls, NULL, &msgid);
23212322
} else {
2322-
i = ldap_add_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL);
2323+
ldap_status_code = ldap_add_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL);
23232324
}
2324-
if (i != LDAP_SUCCESS) {
2325-
php_error_docref(NULL, E_WARNING, "Add: %s", ldap_err2string(i));
2325+
if (ldap_status_code != LDAP_SUCCESS) {
2326+
php_error_docref(NULL, E_WARNING, "Add: %s", ldap_err2string(ldap_status_code));
23262327
RETVAL_FALSE;
23272328
} else if (ext) {
2328-
i = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
2329-
if (i == -1) {
2329+
ldap_status_code = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
2330+
if (ldap_status_code == -1) {
23302331
php_error_docref(NULL, E_WARNING, "Add operation failed");
23312332
RETVAL_FALSE;
23322333
goto cleanup;
@@ -2339,16 +2340,16 @@ static void php_ldap_do_modify(INTERNAL_FUNCTION_PARAMETERS, int oper, int ext)
23392340
} else RETVAL_TRUE;
23402341
} else {
23412342
if (ext) {
2342-
i = ldap_modify_ext(ld->link, dn, ldap_mods, lserverctrls, NULL, &msgid);
2343+
ldap_status_code = ldap_modify_ext(ld->link, dn, ldap_mods, lserverctrls, NULL, &msgid);
23432344
} else {
2344-
i = ldap_modify_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL);
2345+
ldap_status_code = ldap_modify_ext_s(ld->link, dn, ldap_mods, lserverctrls, NULL);
23452346
}
2346-
if (i != LDAP_SUCCESS) {
2347-
php_error_docref(NULL, E_WARNING, "Modify: %s", ldap_err2string(i));
2347+
if (ldap_status_code != LDAP_SUCCESS) {
2348+
php_error_docref(NULL, E_WARNING, "Modify: %s", ldap_err2string(ldap_status_code));
23482349
RETVAL_FALSE;
23492350
} else if (ext) {
2350-
i = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
2351-
if (i == -1) {
2351+
ldap_status_code = ldap_result(ld->link, msgid, 1 /* LDAP_MSG_ALL */, NULL, &ldap_res);
2352+
if (ldap_status_code == -1) {
23522353
php_error_docref(NULL, E_WARNING, "Modify operation failed");
23532354
RETVAL_FALSE;
23542355
goto cleanup;

0 commit comments

Comments
 (0)