Merged
Conversation
There was a problem hiding this comment.
Copilot reviewed 4 out of 23 changed files in this pull request and generated no comments.
Files not reviewed (19)
- src/array.c: Language not supported
- src/buffer.c: Language not supported
- src/erbx.c: Language not supported
- src/include/array.h: Language not supported
- src/include/buffer.h: Language not supported
- src/include/erbx.h: Language not supported
- src/include/macros.h: Language not supported
- src/include/memory.h: Language not supported
- src/include/token.h: Language not supported
- src/include/util.h: Language not supported
- src/io.c: Language not supported
- src/lexer.c: Language not supported
- src/location.c: Language not supported
- src/main.c: Language not supported
- src/memory.c: Language not supported
- src/token.c: Language not supported
- src/util.c: Language not supported
- test/main.c: Language not supported
- test/test_array.c: Language not supported
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.
This pull request includes several improvements and refactorings to enhance memory safety, buffer handling, and code organization. The most important changes involve refactoring the
bufferandarraymodules to use safer memory allocation functions, adding error handling, and introducing new utility functions.This is a follow up to #26 to address the valid
bugprone-suspicious-realloc-usageit caught.Memory Safety Enhancements:
safe_malloc,safe_realloc,nullable_safe_malloc, andnullable_safe_reallocfunctions to handle memory allocation safely and provide better error handling. (src/include/memory.h,src/memory.c).Buffer Handling Improvements:
src/buffer.c: Refactored thebuffer_append,buffer_prepend, andbuffer_concatfunctions to use a safer reallocation function and added error handling for memory allocation failures. Added new functionsbuffer_increase_capacity,buffer_append_char,buffer_reserve, andbuffer_clear.src/array.c: Refactored thearray_appendandarray_freefunctions to use a safer reallocation function and added error handling for memory allocation failures.src/lexer.c,src/include/lexer.h).Error Handling Improvements:
src/array.c,src/buffer.c,src/io.c.Miscellaneous:
bugprone-suspicious-realloc-usagecheck in.clang-tidyto catch potential issues with realloc usage (.clang-tidy)Test suite enhancements:
test/main.c: Updated the test suite to include new test cases for thearray,buffer, andiomodules.