Log qprintf Errors in xstring.c - #103
Open
Lightning11wins wants to merge 27 commits into
Open
Conversation
…branch). Fix a bug in qprintf() that caused % and & characters inside conditional printing areas to always print, regardless of the condition. Improve documentation for qpfPrintf_va_internal() and qpf_grow_fn_t(). Clean up.
Reorder some code to improve clarity. Add various comments. Fix spacing mistakes. Add void to function signatures that do not take parameters.
Clean up some overly cleaver code.
…d more comments. Overhaul qpf_internal_Translate() to improve readability. Improve readability of qpf_internal_SetupTable(). Improve code in multiple functions that ensures the module is initialized. Clean up and improve function doc comments.
Add line numbers to errors. Add qpfLogErrors(). Add qpf_internal_getErrorName(). Add qpf_internal_count_zeros(). Add QPF_ERR_T_NO_ERRORS. Add QPF_ERR_COUNT. Improve formating of QPF_ERR_T defines.
…bility using better code patterns.
Add docs for session functions. Add license. Clarify how to use source and filter format specifiers. Simplify wording for filter specifiers to improve readability.
Fix is_only_followed_by_nlen using || instead of &&. Fix closing quote space check didn't handle buffer overflows very well. Fix null_session error line numbers not being initialized. Fix qpfClearErrors() being lazy about clearing error line numbers. Fix qpf_internal_count_zeros(0) edge case.
Fix a quote buffer overflow comment from Greptile. Add test_qprintf_69.c to validate that the "fixed" code now works properly. Note: Honestly, I'm so in the weeds that I only understand about 80% of what's going on here, but it works, and this probably isn't worth a ton of additional effort.
Remove an error check that always passed. Add more explicit typecasts. Update qpf_internal_itoa() to return size_t because it cannot error. Add an UNLIKELY() to speed up qpf_internal_itoa(). Fix missing info in the qpf_internal_itoa() doc comment.
Add a test case to verify that the buffer underflow is fixed. Clean up and improve correctness of test cases added on this branch.
…unsigned ints. Add an error message if a line number overflows USHRT_MAX. Add a doc comment to error sessions.
Add qpfNoGrow() and qpfSysMallocGrow() grow functions for use when calling qpfPrint_g*() functions. Add qpfPrintf_g() and qpfPrintf_gva() qprintf variants that allow passing a grow function. Improve doc comments for all qpfPrintf*() functions.
Add code to use a pQPSession to record errors. Add call to qpfLogErrors() when an error occurs. Update copyright notice. Clean up.
Contributor
Greptile SummaryThe PR expands qprintf error-session diagnostics and uses them to report failures from XString formatting, while also refactoring the qprintf implementation and adding buffer-boundary regression coverage.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| centrallix-lib/include/qprintf.h | Extends the public session structure and API declarations for recording and logging qprintf errors. |
| centrallix-lib/src/qprintf.c | Adds per-error source-line tracking and logging while substantially refactoring formatting and buffer-management code. |
| centrallix-lib/src/xstring.c | Integrates qprintf error sessions into XString formatting and safely handles session-allocation failure. |
| centrallix-lib/tests/test_qprintf_69.c | Adds regression coverage for quoted output in a two-byte destination buffer. |
| centrallix-lib/tests/test_qprintf_70.c | Adds regression coverage preventing underflow around a one-byte destination buffer. |
| centrallix-sysdoc/QPrintf.md | Documents error-session APIs and clarifies the supported qprintf format specifiers. |
Reviews (3): Last reviewed commit: "Merge branch 'master' into log-qprintf-e..." | Re-trigger Greptile
Contributor
Author
|
This PR is ready for human review. |
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.
Quick change that improves error handling of qprintf errors in
xstring.c.GitHub Relationships
These will need to be reviewed and merged into master before this PR is reviewed.