Page MenuHomeFreeBSD

style: Remove remaining deprecated MALLOC/FREE macros
ClosedPublic

Authored by cem on Jan 24 2018, 8:24 PM.
Tags
None
Referenced Files
F105909727: D14035.diff
Sun, Dec 22, 12:02 PM
Unknown Object (File)
Wed, Dec 11, 1:26 AM
Unknown Object (File)
Mon, Dec 2, 10:29 AM
Unknown Object (File)
Mon, Dec 2, 10:29 AM
Unknown Object (File)
Mon, Dec 2, 10:29 AM
Unknown Object (File)
Mon, Dec 2, 10:04 AM
Unknown Object (File)
Thu, Nov 28, 9:39 PM
Unknown Object (File)
Thu, Nov 28, 9:38 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 Warnings
SeverityLocationCodeMessage
Warningsys/fs/nfsclient/nfs_clvfsops.c:1395SPELL1Possible Spelling Mistake
Warningsys/fs/nfsclient/nfs_clvfsops.c:1655SPELL1Possible Spelling Mistake
Unit
No Test Coverage
Build Status
Buildable 14560
Build 14697: arc lint + arc unit

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

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

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

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

Ok, will do.

This revision was automatically updated to reflect the committed changes.