Merge av_value_to_string & av_replace_placeholders into av_error_messages (option B) - #29
Draft
matapatos wants to merge 1 commit into
Draft
Merge av_value_to_string & av_replace_placeholders into av_error_messages (option B)#29matapatos wants to merge 1 commit into
matapatos wants to merge 1 commit into
Conversation
…v_error_messages Consolidate the three error-message translation units into a single av_error_messages.c. To keep the merged TU linkable in the Ceedling unit-test build (which has no Zend engine), route every direct Zend call through av_wrappers: zend_hash_find/next_index_insert/add, zend_new_array, zend_lookup_class_ex, zend_string_init (via a new av_zval_stringl), snprintf (av_snprintf) and fmax (av_fmax). Drop the hand-written build_union_type_string stub in test_error_messages.c; the tests now link the real implementation and build zend_type values by mask, exercising the genuine type-to-article logic. Add ap_php_snprintf/ap_php_vsnprintf stubs to the test helpers so test files can keep using snprintf() after php.h redefines it. Co-authored-by: matapatos <matapatos@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
av_value_to_string.candav_replace_placeholders.cintoav_error_messages.c, consolidating the three error-message translation units into one. The two old.cfiles are removed and dropped fromconfig.m4.av_wrappers:zend_hash_find/zend_hash_next_index_insert/zend_hash_add,zend_new_array,zend_lookup_class_ex,ZVAL_STRINGL→av_zval_stringl,snprintf→av_snprintf, andfmax→av_fmax.build_union_type_stringstub intest_error_messages.c; the test now links the real implementation and constructszend_typevalues by mask (MAY_BE_LONG,MAY_BE_STRING,MAY_BE_DOUBLE), so the{expected}placeholder tests exercise the genuine type-to-article logic.ap_php_snprintf/ap_php_vsnprintfstubs to the test helpers (delegating to__builtin_vsnprintf) so test files keep usingsnprintf()afterphp.hredefines it.Verification
TESTED: 129, PASSED: 129, FAILED: 0(baseline was 129 passing too).2 failed, 703 passed— identical to the unmodifiedmainbaseline. The 2 failures are pre-existing inErrorHandlingTest(an unwired enum "selected is invalid" code path) and unrelated to this refactor.clang-format --dry-run --Werroron all.c/.h: clean (no violations in changed files).clang-tidy(config.m4 sources): 6 warnings, all in pre-existing files (av_call_function.c,av_model_configs.c,av_validate_function.c) — same count as baseline; none inav_error_messages.corav_wrappers.c.WarningsAsErrorsis empty, so CI passes.phpize && ./configure && make).Notes
ErrorHandlingTestfailures exist onmainwithout my changes (verified by stashing and re-running). They stem fromgenerate_error_message/is_type_enumbeing defined but never called — out of scope for this consolidation.