-
Notifications
You must be signed in to change notification settings - Fork 0
Normilize path separators #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c475d95 to
2e8b49f
Compare
8b58657 to
a91c5b6
Compare
|
All tests and benchmarks pass with commit a91c5b6 in
|
a91c5b6 to
6d146da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces functions to normalize file path separators and updates both the implementation and tests accordingly.
- Added new functions IsPathNormalized and NormailizePathSeparatorsInPlace in FileUtils.h and implemented them in FileUtils.c.
- Updated main.c to utilize the new normalization function when processing input paths.
- Expanded the test suite in TestFileUtils.c to cover both normalized and unnormalized path cases.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| CoDeLib/include/CoDeLib/FileUtils/FileUtils.h | Added declarations for path normalization functions. |
| CoDeLib/FileUtils/src/FileUtils.c | Implemented the normalization functions and integrated them into other APIs. |
| CoDeLib/Test/src/main.c | Updated usage of path normalization for processing input paths. |
| CoDeLib/Test/src/TestFileUtils.c | Added test cases to validate path normalization behavior. |
Comments suppressed due to low confidence (1)
CoDeLib/include/CoDeLib/FileUtils/FileUtils.h:28
- Consider renaming 'NormailizePathSeparatorsInPlace' to 'NormalizePathSeparatorsInPlace' to correct the spelling and improve clarity.
char *NormailizePathSeparatorsInPlace(char *pPath);
| return false; | ||
| } | ||
|
|
||
| for (size_t i = 0; i < strlen(pPath); ++i) { |
Copilot
AI
Jun 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Store the result of strlen(pPath) in a local variable before the loop to avoid multiple calls during iteration.
| for (size_t i = 0; i < strlen(pPath); ++i) { | |
| size_t pathLength = strlen(pPath); | |
| for (size_t i = 0; i < pathLength; ++i) { |
| return NULL; | ||
| } | ||
|
|
||
| for (size_t i = 0; i < strlen(pPath); ++i) { |
Copilot
AI
Jun 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storing the length of pPath in a variable before iterating can improve performance by preventing repeated calls to strlen.
| for (size_t i = 0; i < strlen(pPath); ++i) { | |
| size_t pathLength = strlen(pPath); | |
| for (size_t i = 0; i < pathLength; ++i) { |
|
Tests and benchmark from 6d146da also pass on the Zybo. |
No description provided.