Skip to content

Replaced magic numbers with named constants#62

Merged
byteshiftlabs merged 4 commits intomainfrom
improve-code-quality
Feb 8, 2026
Merged

Replaced magic numbers with named constants#62
byteshiftlabs merged 4 commits intomainfrom
improve-code-quality

Conversation

@byteshiftlabs
Copy link
Owner

Changes

  • Created centralized constants.h with 200+ semantic constants
  • Fixed errno handling: converted set_errno/return-1 to RETURN_ERRNO
  • Replaced hardcoded values: sector size, timer freq, paths, colors, MMIO addresses
  • Fixed 6 allocation failures in ext2_write.c
  • Removed duplicate code in trap.c

Testing

  • Build: 0 errors, 0 warnings
  • QEMU boot test: PASSES

- Created centralized constants.h with 200+ semantic constants
- Fixed errno handling: converted set_errno/return-1 to RETURN_ERRNO
- Replaced hardcoded values: sector size, timer freq, paths, colors, MMIO addresses
- Fixed 6 allocation failures in ext2_write.c
- Removed duplicate code in trap.c
- Build: 0 errors, 0 warnings
@byteshiftlabs byteshiftlabs self-assigned this Feb 8, 2026
@byteshiftlabs byteshiftlabs added the code-refactor Code refactoring and cleanup label Feb 8, 2026
@byteshiftlabs byteshiftlabs merged commit b301009 into main Feb 8, 2026
2 checks passed
@byteshiftlabs byteshiftlabs deleted the improve-code-quality branch February 8, 2026 17:00
byteshiftlabs added a commit that referenced this pull request Feb 26, 2026
## Changes
- Created centralized constants.h with 200+ semantic constants
- Fixed errno handling: converted set_errno/return-1 to RETURN_ERRNO
- Replaced hardcoded values: sector size, timer freq, paths, colors,
MMIO addresses
- Fixed 6 allocation failures in ext2_write.c
- Removed duplicate code in trap.c

## Testing
- Build: 0 errors, 0 warnings
- QEMU boot test: PASSES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-refactor Code refactoring and cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant