Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

potion.h: use 'potion_fwd' instead of repeating the code.

  • Loading branch information...
commit e8efa10cc7e044a205bdb21e2bd3514a0bb4cbff 1 parent eaa3e53
@orangea orangea authored committed
Showing with 2 additions and 6 deletions.
  1. +2 −6 core/potion.h
View
8 core/potion.h
@@ -341,16 +341,12 @@ struct PNCont {
};
// the potion type is the 't' in the vtable tuple (m,t)
+static inline PN potion_fwd(PN);
static inline PNType potion_type(PN obj) {
if (PN_IS_NUM(obj)) return PN_TNUMBER;
if (PN_IS_BOOL(obj)) return PN_TBOOLEAN;
if (PN_IS_NIL(obj)) return PN_TNIL;
- while (1) {
- struct PNFwd *o = (struct PNFwd *)obj;
- if (o->fwd != POTION_FWD)
- return ((struct PNObject *)o)->vt;
- obj = o->ptr;
- }
+ return ((struct PNObject *)potion_fwd(obj))->vt;
}
// macro for doing a single fwd check after a possible realloc
Please sign in to comment.
Something went wrong with that request. Please try again.