Skip to content

Commit 3716634

Browse files
committed
experiment: replace SETUPEXCHANGE by a function
1 parent 34afbd1 commit 3716634

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

win32/perlhost.h

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,16 +2140,20 @@ CPerlHost::CPerlHost(void)
21402140
m_pHostperlProc = &perlProc;
21412141
}
21422142

2143-
#define SETUPEXCHANGE(xptr, iptr, table) \
2144-
STMT_START { \
2145-
if (xptr) { \
2146-
iptr = *xptr; \
2147-
*xptr = &table; \
2148-
} \
2149-
else { \
2150-
iptr = &table; \
2151-
} \
2152-
} STMT_END
2143+
template<typename T>
2144+
static void
2145+
setupexchange(const T **xptr, const T *&iptr, const T *ptable)
2146+
{
2147+
if (xptr) {
2148+
iptr = *xptr;
2149+
*xptr = ptable;
2150+
}
2151+
else {
2152+
iptr = ptable;
2153+
}
2154+
}
2155+
2156+
#define SETUPEXCHANGE(xptr, iptr, table) setupexchange(xptr, iptr, &(table))
21532157

21542158
CPerlHost::CPerlHost(const struct IPerlMem** ppMem, const struct IPerlMem** ppMemShared,
21552159
const struct IPerlMem** ppMemParse, const struct IPerlEnv** ppEnv,

0 commit comments

Comments
 (0)