Skip to content

Commit 7387efc

Browse files
goto
1 parent b6d253e commit 7387efc

File tree

1 file changed

+6
-29
lines changed

1 file changed

+6
-29
lines changed

Zend/zend_attributes.c

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,7 @@ static void validate_class_alias(
267267
if (attr->argc < 1 || attr->argc > 2) {
268268
zend_wrong_parameters_count_error(1, 2);
269269

270-
EG(current_execute_data) = constructor_call->prev_execute_data;
271-
zend_vm_stack_free_call_frame(constructor_call);
272-
273-
EG(current_execute_data) = call->prev_execute_data;
274-
zend_vm_stack_free_call_frame(call);
275-
return;
270+
goto restore_execution_data;
276271
}
277272

278273
zval *found = NULL;
@@ -290,11 +285,7 @@ static void validate_class_alias(
290285
}
291286
if (found == NULL) {
292287
zend_argument_error(zend_ce_argument_count_error, 1, "not passed");
293-
EG(current_execute_data) = constructor_call->prev_execute_data;
294-
zend_vm_stack_free_call_frame(constructor_call);
295-
EG(current_execute_data) = call->prev_execute_data;
296-
zend_vm_stack_free_call_frame(call);
297-
return;
288+
goto restore_execution_data;
298289
}
299290
}
300291

@@ -307,11 +298,7 @@ static void validate_class_alias(
307298
Z_EXPECTED_STRING,
308299
found
309300
);
310-
EG(current_execute_data) = constructor_call->prev_execute_data;
311-
zend_vm_stack_free_call_frame(constructor_call);
312-
EG(current_execute_data) = call->prev_execute_data;
313-
zend_vm_stack_free_call_frame(call);
314-
return;
301+
goto restore_execution_data;
315302
}
316303

317304
zend_result result = zend_register_class_alias_ex(
@@ -325,11 +312,7 @@ static void validate_class_alias(
325312
ZSTR_VAL(alias),
326313
ZSTR_VAL(scope->name)
327314
);
328-
EG(current_execute_data) = constructor_call->prev_execute_data;
329-
zend_vm_stack_free_call_frame(constructor_call);
330-
EG(current_execute_data) = call->prev_execute_data;
331-
zend_vm_stack_free_call_frame(call);
332-
return;
315+
goto restore_execution_data;
333316
}
334317

335318
zend_string *lc_name;
@@ -365,11 +348,7 @@ static void validate_class_alias(
365348
break;
366349
}
367350
zend_throw_error(NULL, "Unknown named parameter $%s", ZSTR_VAL(attr->args[i].name));
368-
EG(current_execute_data) = constructor_call->prev_execute_data;
369-
zend_vm_stack_free_call_frame(constructor_call);
370-
EG(current_execute_data) = call->prev_execute_data;
371-
zend_vm_stack_free_call_frame(call);
372-
return;
351+
goto restore_execution_data;
373352
}
374353
}
375354
ZEND_ASSERT(nested_attribs != NULL);
@@ -388,13 +367,11 @@ static void validate_class_alias(
388367
}
389368
}
390369

391-
// zval_ptr_dtor(alias_name);
392-
// zval_ptr_dtor(&alias_obj);
370+
restore_execution_data:
393371
EG(current_execute_data) = constructor_call->prev_execute_data;
394372
zend_vm_stack_free_call_frame(constructor_call);
395373
EG(current_execute_data) = call->prev_execute_data;
396374
zend_vm_stack_free_call_frame(call);
397-
return;
398375
}
399376

400377
ZEND_METHOD(Attribute, __construct)

0 commit comments

Comments
 (0)