kosmas12 / kOS

A test operating system made for fun
GNU General Public License v2.0
0 stars 1 forks source link

(Untested) Minor code refactor and fixes. #3

Closed ghost closed 9 months ago

ghost commented 3 years ago

These are a few commits of code refactor I thought I would do. These are untested as I cannot build the kernel on my system with the kernel build system put into place.

I do not recommend merging this, it is meant only as a reference

recommendation: Keyboard map. Even if it wouldn't be used for a small kernel such as this, it would still be good practice to be able to handle multiple keyboard layouts and not hard code one in.

ODR:

Other refactors:

if (...)
    do_thing();
else
   do_else_thing();
if (...) {
    do_thing();
    do_another_thing();
} ...
kosmas12 commented 3 years ago

I checked the commits, this seems like it would work (haven't actually tested yet though). As for the code itself, I see the most changes were removing {} in single-statement if, else and for statements and moving implementations from .h files to .c files (which is actually good, I don't know how this escaped my mind) (also some makefile entries for the .c files will be needed, but those are easy to add), also moving the keyboard map to a different file. I'd gladly accept all changes except the {} removal. Perhaps it's because I'm dumb, but sometimes missing curly brackets confuses me (this might sound stupid but I can't really do anything about it, I'm just used to seeing {}). Thanks a ton for this!