From e3a26eab8a92709388debb9cb2763c33de0e7ae3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net> Date: Fri, 21 Jun 1996 21:44:52 +0200 Subject: [PATCH] construcor/destructor calls optimized Rev: src/object.c:1.10 Rev: src/object.h:1.6 --- src/object.c | 11 +++++++---- src/object.h | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/object.c b/src/object.c index 41af09bbb0..87e73b7289 100644 --- a/src/object.c +++ b/src/object.c @@ -103,9 +103,9 @@ struct object *clone(struct program *p, int args) o->refs++; } - apply(o,"__INIT",0); + apply_lfun(o,LFUN___INIT,0); pop_stack(); - apply(o,"create",args); + apply_lfun(o,LFUN_CREATE,args); pop_stack(); return o; @@ -163,8 +163,11 @@ void destruct(struct object *o) o->refs++; - safe_apply(o, "destroy", 0); - pop_stack(); + if(o->prog->lfuns[LFUN_DESTROY] != -1) + { + safe_apply_low(o, o->prog->lfuns[LFUN_DESTROY], 0); + pop_stack(); + } /* destructed in destroy() */ if(!o->prog) diff --git a/src/object.h b/src/object.h index e4bb8cd0dd..5b8d728373 100644 --- a/src/object.h +++ b/src/object.h @@ -29,6 +29,8 @@ extern struct object *first_object; #define GET_GLOBAL(O,I) LOW_GET_GLOBAL(O,I,ID_FROM_INT((O)->prog,I)) #define GLOBAL_FROM_INT(I) GET_GLOBAL(fp->current_object, I) +#define this_object() (fp->current_object->refs++,fp->current_object) + /* Prototypes begin here */ void setup_fake_object(); struct object *clone(struct program *p, int args); -- GitLab