From: Vincent Pit Date: Fri, 27 Mar 2009 00:31:57 +0000 (+0100) Subject: Fix building with PERL_IMPLICIT_SYS X-Git-Tag: v0.05~3 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=commitdiff_plain;h=77c47109071d7fa2e5e648684ab843487196cada Fix building with PERL_IMPLICIT_SYS --- diff --git a/Types.xs b/Types.xs index d2bfb03..60f499c 100644 --- a/Types.xs +++ b/Types.xs @@ -74,7 +74,8 @@ typedef struct { OP *(*pp_padsv)(pTHX); } lt_op_info; -STATIC void lt_map_store(const OP *o, SV *orig_pkg, SV *type_pkg, SV *type_meth, OP *(*pp_padsv)(pTHX)) { +STATIC void lt_map_store(pPTABLE_ const OP *o, SV *orig_pkg, SV *type_pkg, SV *type_meth, OP *(*pp_padsv)(pTHX)) { +#define lt_map_store(O, OP, TP, TM, PP) lt_map_store(aPTABLE_ (O), (OP), (TP), (TM), (PP)) lt_op_info *oi; #ifdef USE_ITHREADS diff --git a/ptable.h b/ptable.h index 5cd5a90..a279736 100644 --- a/ptable.h +++ b/ptable.h @@ -6,6 +6,18 @@ * shared across threads. * Copyright goes to the original authors, bug reports to me. */ +#ifdef PERL_IMPLICIT_SYS +# define pPTABLE pTHX +# define pPTABLE_ pTHX_ +# define aPTABLE aTHX +# define aPTABLE_ aTHX_ +#else +# define pPTABLE +# define pPTABLE_ +# define aPTABLE +# define aPTABLE_ +#endif + typedef struct ptable_ent { struct ptable_ent *next; const void * key; @@ -22,7 +34,8 @@ typedef struct ptable { # define PTABLE_VAL_FREE(V) #endif -STATIC ptable *ptable_new(void) { +STATIC ptable *ptable_new(pPTABLE) { +#define ptable_new() ptable_new(aPTABLE) ptable *t = PerlMemShared_malloc(sizeof *t); t->max = 127; t->items = 0; @@ -52,7 +65,8 @@ STATIC void *ptable_fetch(const ptable * const t, const void * const key) { return ent ? ent->val : NULL; } -STATIC void ptable_split(ptable * const t) { +STATIC void ptable_split(pPTABLE_ ptable * const t) { +#define ptable_split(T) ptable_split(aPTABLE_ (T)) ptable_ent **ary = t->ary; const UV oldsize = t->max + 1; UV newsize = oldsize * 2; @@ -80,7 +94,8 @@ STATIC void ptable_split(ptable * const t) { } } -STATIC void ptable_store(ptable * const t, const void * const key, void * const val) { +STATIC void ptable_store(pPTABLE_ ptable * const t, const void * const key, void * const val) { +#define ptable_store(T, K, V) ptable_store(aPTABLE_ (T), (K), (V)) ptable_ent *ent = ptable_find(t, key); if (ent) { @@ -102,7 +117,8 @@ STATIC void ptable_store(ptable * const t, const void * const key, void * const #if 0 -STATIC void ptable_clear(ptable * const t) { +STATIC void ptable_clear(pPTABLE_ ptable * const t) { +#define ptable_clear(T) ptable_clear(aPTABLE_ (T)) if (t && t->items) { register ptable_ent ** const array = t->ary; UV i = t->max; @@ -123,7 +139,8 @@ STATIC void ptable_clear(ptable * const t) { } } -STATIC void ptable_free(ptable * const t) { +STATIC void ptable_free(pPTABLE_ ptable * const t) { +#define ptable_free(T) ptable_free(aPTABLE_ (T)) if (!t) return; ptable_clear(t);