-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
Same as #18, but for the macros in op.h.
The main difference is most of these are publicly documented. Even if they're not documented, some 3rd party Perl module might be using them. That means _the name, signature and functionality cannot change_.
To preserve their visibility, and to allow inlining...
- Put the new function directly in op.h.
- Declare it
static inline. - Retain the exact name and signature.
- If you you think you can improve the code, write a compatibility wrapper.
- Change references to "macro" in the api documentation to "function".
- The documentation is
=for apidocin op.h.
- The documentation is
- (Optional) Move the documentation to be above the function
For example...
#define OP_TYPE_IS(o, type) ((o) && (o)->op_type == (type))
Is replaced, _directly in op.h_, with...
static inline bool OP_TYPE_IS(OP *o, Optype type) {
return o && o->op_type == type;
}
The documentation is changed to remove the mention of a macro...
=for apidoc Am|bool|OP_TYPE_IS|OP *o|Optype type
Returns true if the given OP is not a NULL pointer
and if it is of the given type.
The negation of this, C<OP_TYPE_ISNT> is also available
as well as C<OP_TYPE_IS_NN> and C<OP_TYPE_ISNT_NN> which elide
the NULL pointer check.