From 7627e6d0fe772ac90fce9e03fea273109521e261 Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 8 Jan 2011 15:56:22 +0000 Subject: Generate "Unsupported socket function" stubs using PL_ppaddr. Instead of having each socket op conditionally compile as either the implementation or a DIE() depending on #HAS_SOCKET 1: remove the conditional code from the ops themselves 2: only compile the ops if HAS_SOCKET is defined 3: general conditional code for the intialisation of PL_ppaddr - as appropriate either the ops, or Perl_unimplemented_op 4: Amend Perl_unimplemented_op to generate the appropriate DIE() for socket ops (ie not the "panic"... message) Whilst this complicates the support code in regen/opcode.pl, it's already a net saving of 5 lines in the C code. --- pp.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pp.c') diff --git a/pp.c b/pp.c index ba12f6c84c..df28740929 100644 --- a/pp.c +++ b/pp.c @@ -6306,6 +6306,8 @@ PP(unimplemented_op) NULL doesn't generate a useful error message. "custom" does. */ const char *const name = op_type >= OP_max ? "[out of range]" : PL_op_name[PL_op->op_type]; + if(OP_IS_SOCKET(op_type)) + DIE(aTHX_ PL_no_sock_func, name); DIE(aTHX_ "panic: unimplemented op %s (#%d) called", name, op_type); } -- cgit v1.2.1