Skip to content
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

Refactor VFS file operations for improved readability and consistency #60

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

dogo
Copy link
Owner

@dogo dogo commented Sep 7, 2024

Description

This PR refactors the VFS file operations to improve code readability, maintainability, and ensure consistent behavior across file operations. Key changes include:

  • Refactored core file operations:

    • Simplified vfsFileOpen, vfsFileClose, vfsFileRead, vfsFileWrite, vfsFileSeek, and vfsFileTell.
    • Ensured proper handling of file modes (read, write, read/write) and resource cleanup.
  • Memory-based fallbacks:

    • Integrated vfsMemGetc, vfsMemPutc, vfsMemGets, and vfsMemPuts as fallbacks for standard I/O functions.
  • Improved EOF handling:

    • Added clear EOF flag management after read and seek operations.
  • Code cleanup:

    • Reduced redundancy, used consistent return types, and streamlined function logic.

Impact

These changes enhance the overall structure and behavior of the VFS system, making it easier to maintain and extend. No changes in functionality, just internal improvements.

- Refactored open, close, read, write, seek, and tell functions.
- Streamlined memory-based fallbacks for getc, putc, gets, and puts.
- Enhanced EOF handling and code readability.
@dogo dogo merged commit 1439bf8 into master Sep 8, 2024
6 checks passed
@dogo dogo deleted the refactor/vfsFile branch September 8, 2024 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant