-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fdwrite.c: initialize pointers to NULL and a few other cleanups #1059
Conversation
rilysh
commented
Jan 14, 2024
- Both trackbuf and vrfybuf are initialized to zero (NULL). While it's okay to initialize pointers to zero, to keep consistency, as they're explicitly pointers, it's better to just use NULL ((void *)0) instead of 0 (both are equivalent to the compilers).
- Call free() for both trackbuf and vrfybuf after their job has been done.
- Remove the register keyword. Compilers generally ignore this keyword (except for very very old compilers and CPUs).
- Remove the ctype.h header. It's not being used anywhere in the file.
1. Both trackbuf and vrfybuf are initialized to zero (NULL). While it's okay to initialize pointers to zero, to keep consistency, as they're explicitly pointers, it's better to just use NULL ((void *)0) instead of 0 (both are equivalent to the compilers). 2. Call free() for both trackbuf and vrfybuf after their job has been done. 3. Remove the register keyword. Compilers generally ignore this keyword (except for very very old compilers and CPUs). 4. Remove the ctype.h header. It's not being used anywhere in the file. Signed-off-by: rilysh <nightquick@proton.me>
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.
looks sensible 👍
@@ -26,7 +25,7 @@ format_track(int fd, int cyl, int secs, int head, int rate, | |||
int gaplen, int secsize, int fill, int interleave) | |||
{ | |||
struct fd_formb f; | |||
register int i,j; | |||
int i,j; | |||
int il[100]; | |||
|
|||
memset(il,0,sizeof il); |
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.
while you're already here, why not format this according to style(9)
.
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.
I intentionally left it behind as style(9)
also says to indent the first level with 8 characters (tabs) and running indent(1)
drastically changes the indentation (which I wasn't sure about whether should I apply or not)...
I think for now I'll apply it for these (CI) warnings only. If full indentation is acceptable, then I will add that too.
CI Link: https://github.com/freebsd/freebsd-src/actions/runs/7517809483/job/20464384723?pr=1059
Signed-off-by: rilysh <nightquick@proton.me>
We have plans to remove floppy support soon. Not sure it is worth the effort |
Whoops... I didn't know that, is there a current plan on which version of FreeBSD release floppy support will be stripped away? (e.g. the version, 14.0) |
14.0 has sailed, so even tho i haven't seen it on the plan for 15.0, the fact that we're getting rid of 32 bit platforms (in the kernel) kind of hints at other things that might fall to the ax |
We've explicitly had fd on the list for a while. It won't be in 15. If we'd realized sooner, we'd have trimmed it for 14, but the trim list for that was already fairly large. |
I went ahead and pushed this... Though in the future, a pull request like this would run into our new policy that say a change has to fix a real problem. |
damn, I gotta update my landing scripts to properly credit... I just noticed @igalic approved, which should have added a reviewed by line. |
1. Both trackbuf and vrfybuf are initialized to zero (NULL). While it's okay to initialize pointers to zero, to keep consistency, as they're explicitly pointers, it's better to just use NULL ((void *)0) instead of 0 (both are equivalent to the compilers). 2. Call free() for both trackbuf and vrfybuf after their job has been done. 3. Remove the register keyword. Compilers generally ignore this keyword (except for very very old compilers and CPUs). 4. Remove the ctype.h header. It's not being used anywhere in the file. Signed-off-by: rilysh <nightquick@proton.me> Reviewed by: imp Pull Request: #1059
1. Both trackbuf and vrfybuf are initialized to zero (NULL). While it's okay to initialize pointers to zero, to keep consistency, as they're explicitly pointers, it's better to just use NULL ((void *)0) instead of 0 (both are equivalent to the compilers). 2. Call free() for both trackbuf and vrfybuf after their job has been done. 3. Remove the register keyword. Compilers generally ignore this keyword (except for very very old compilers and CPUs). 4. Remove the ctype.h header. It's not being used anywhere in the file. Signed-off-by: rilysh <nightquick@proton.me> Reviewed by: imp Pull Request: freebsd/freebsd-src#1059
1. Both trackbuf and vrfybuf are initialized to zero (NULL). While it's okay to initialize pointers to zero, to keep consistency, as they're explicitly pointers, it's better to just use NULL ((void *)0) instead of 0 (both are equivalent to the compilers). 2. Call free() for both trackbuf and vrfybuf after their job has been done. 3. Remove the register keyword. Compilers generally ignore this keyword (except for very very old compilers and CPUs). 4. Remove the ctype.h header. It's not being used anywhere in the file. Signed-off-by: rilysh <nightquick@proton.me> Reviewed by: imp Pull Request: freebsd/freebsd-src#1059