Page MenuHomeFreeBSD

Change all kernel C-type macros into static inline functions
ClosedPublic

Authored by • hselasky on Mar 24 2019, 3:29 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Sep 23, 3:49 AM
Unknown Object (File)
Wed, Sep 23, 3:47 AM
Unknown Object (File)
Wed, Sep 23, 3:45 AM
Unknown Object (File)
Wed, Sep 23, 3:41 AM
Unknown Object (File)
Sat, Sep 12, 4:25 PM
Unknown Object (File)
Thu, Sep 10, 10:28 PM
Unknown Object (File)
Aug 27 2026, 12:45 AM
Unknown Object (File)
Aug 26 2026, 1:45 AM

Details

Summary

The current kernel C-type macros might obscurely hide the fact that the input argument might be used multiple times.

This breaks code like:
isalpha(*ptr++)

The fix is to use static inline functions.

Sponsored by: Mellanox Technologies
MFC after: 1 week

Test Plan

Diff Detail

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

Event Timeline

Please update revision description (commit message) to indicate that the change is only made to the kernel ctype.h.

I think it would slightly improve compatibility with old compilers if you use __inline instead of inline. I believe we do not support c89/gnuc89 for kernel for quite long time.

sys/sys/ctype.h
83 ↗(On Diff #55406)

There is no reason to not fill the line to end, neither to follow tradition and split line before (instead of after) the binary operator.

• hselasky retitled this revision from Change all C-type macros into static inline functions to Change all kernel C-type macros into static inline functions.
• hselasky edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Mar 24 2019, 8:39 PM
This revision was automatically updated to reflect the committed changes.