Page MenuHomeFreeBSD

style: Remove remaining deprecated MALLOC/FREE macros
ClosedPublic

Authored by cem on Jan 24 2018, 8:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 14 2024, 11:07 AM
Unknown Object (File)
Mar 14 2024, 11:07 AM
Unknown Object (File)
Mar 14 2024, 11:07 AM
Unknown Object (File)
Mar 7 2024, 8:55 PM
Unknown Object (File)
Jan 6 2024, 8:32 PM
Unknown Object (File)
Jan 6 2024, 8:32 PM
Unknown Object (File)
Jan 6 2024, 8:28 PM
Unknown Object (File)
Jan 3 2024, 4:40 PM
Subscribers

Details

Summary

Mechanically replace uses of MALLOC/FREE with appropriate invocations of
malloc(9) / free(9) (a series of sed expressions).

No functional change.

For now, punt on modifying contrib ipfilter code, leaving a definition of
the macro in its KMALLOC().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

The ipf bits are acceptable.

This revision is now accepted and ready to land.Jan 24 2018, 8:59 PM
sys/fs/nfs/nfsport.h
635 ↗(On Diff #38406)

This could just be an M_ZERO allocation.

This macro is only used in 3 places. Does anyone feel strongly about getting rid of it? (Ditto the FREE version, except like 8 places.)

It could be done separately / in a subsequent patch.

sys/fs/nfs/nfsport.h
635 ↗(On Diff #38406)

I don't see any reason to keep it, but it's rmacklem's call. It's probably best left to another patch though.

The replacement of MALLOC/FREE in the NFS code looks ok to me.
As I noted in the inline comment, I used to care about portability to
other BSDen, but I don't any more. (None of them seem interested
in the code..)

Btw, as an historical note, some of this code is so old that I think
the 4BSD rule of "use the macros for frequently executed code,
since the macros had a fast path" might still have applied, but
obviously this is no more;-)

I could be style nitpicky and mention that many of the
MALLOC->malloc cases have resulted in short statements
over two lines that could probably bow be on a single line,
but I don't really care about this, either.

Thanks for doing this. I'm too lazy to do this kind of editting, rick.

sys/fs/nfs/nfsport.h
635 ↗(On Diff #38406)

Yea, I have no problem with replacing the NFSBZERO() with a M_ZERO flag.
There was a time when I worried about portability to other BSDen, which is
why these macros exist, but I don't much care any more, so if you have burning
desire to replace the NFSSOCKADDR() and NFSSOCKADDRALLOC() macros,
I don't mind.

I could be style nitpicky and mention that many of the
MALLOC->malloc cases have resulted in short statements
over two lines that could probably bow be on a single line,
but I don't really care about this, either.

Yep, those are intentionally left as-is for now to minimize the diff.

sys/fs/nfs/nfsport.h
635 ↗(On Diff #38406)

Ok, will do.

This revision was automatically updated to reflect the committed changes.