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, Jun 26, 1:25 PM
Unknown Object (File)
Tue, Jun 25, 5:24 AM
Unknown Object (File)
May 1 2024, 9:41 AM
Unknown Object (File)
May 1 2024, 9:41 AM
Unknown Object (File)
May 1 2024, 9:41 AM
Unknown Object (File)
May 1 2024, 9:41 AM
Unknown Object (File)
May 1 2024, 1:17 AM
Unknown Object (File)
Dec 20 2023, 11:09 PM

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 Skipped
Unit
Tests Skipped
Build Status
Buildable 23277

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

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.