From 48323cc0196f8aad6912b88fcc97416f06dc1f6d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Fri, 7 Jul 2000 17:31:15 +0200
Subject: [PATCH] fp  ==>  Pike_fp

Rev: src/object.c:1.133
Rev: src/opcodes.c:1.77
Rev: src/security.c:1.27
Rev: src/security.h:1.11
---
 src/object.c   | 27 ++++++++++++++++++---------
 src/opcodes.c  | 10 +++++-----
 src/security.c | 20 ++++++++++----------
 src/security.h |  1 -
 4 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/src/object.c b/src/object.c
index 010142b703..cc92616d1c 100644
--- a/src/object.c
+++ b/src/object.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: object.c,v 1.132 2000/07/06 23:25:26 mast Exp $");
+RCSID("$Id: object.c,v 1.133 2000/07/07 15:31:14 grubba Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -147,7 +147,7 @@ struct object *low_clone(struct program *p)
 
 #define LOW_PUSH_FRAME(O)	do{		\
   struct pike_frame *pike_frame=alloc_pike_frame();		\
-  pike_frame->next=fp;				\
+  pike_frame->next=Pike_fp;			\
   pike_frame->current_object=O;			\
   pike_frame->locals=0;				\
   pike_frame->num_locals=0;				\
@@ -155,7 +155,7 @@ struct object *low_clone(struct program *p)
   pike_frame->pc=0;					\
   pike_frame->context.prog=0;                        \
   pike_frame->context.parent=0;                        \
-  fp= pike_frame
+  Pike_fp= pike_frame
 
 #define PUSH_FRAME(O) \
   LOW_PUSH_FRAME(O); \
@@ -182,19 +182,22 @@ struct object *low_clone(struct program *p)
   
 
 #ifdef DEBUG
-#define CHECK_FRAME() if(pike_frame != fp) fatal("Frame stack out of whack.\n");
+#define CHECK_FRAME() do { \
+    if(pike_frame != Pike_fp) \
+      fatal("Frame stack out of whack.\n"); \
+  } while(0)
 #else
 #define CHECK_FRAME()
 #endif
 
 #define POP_FRAME()				\
   CHECK_FRAME()					\
-  fp=pike_frame->next;				\
+  Pike_fp=pike_frame->next;			\
   pike_frame->next=0;				\
   free_pike_frame(pike_frame); }while(0)
 
 #define LOW_POP_FRAME()				\
-  add_ref(fp->current_object); \
+  add_ref(Pike_fp->current_object); \
   POP_FRAME();
 
 
@@ -483,7 +486,7 @@ static void call_destroy(struct object *o, int foo)
   e=FIND_LFUN(o->prog,LFUN_DESTROY);
   if(e != -1
 #ifdef DO_PIKE_CLEANUP
-     && evaluator_stack
+     && Pike_interpreter.evaluator_stack
 #endif
     )
   {
@@ -582,8 +585,12 @@ void low_destruct(struct object *o,int do_free)
 	free_svalue(s);
       }else{
 	union anything *u;
+	int rtt = pike_frame->context.prog->identifiers[d].run_time_type;
 	u=(union anything *)(pike_frame->current_storage +
 			     pike_frame->context.prog->identifiers[d].func.offset);
+#ifdef PIKE_DEBUG
+	if (rtt <= MAX_REF_TYPE) debug_malloc_touch(u->refs);
+#endif /* PIKE_DEBUG */
 	free_short_svalue(u, pike_frame->context.prog->identifiers[d].run_time_type);
 	DO_IF_DMALLOC(u->refs=(void *)-1);
       }
@@ -1135,6 +1142,8 @@ void cleanup_objects(void)
       debug_malloc_touch(o->storage);
       call_destroy(o,1);
       low_destruct(o,1);
+    } else {
+      debug_malloc_touch(o);
     }
     SET_NEXT_AND_FREE(o,free_object);
   }
@@ -1506,10 +1515,10 @@ void push_magic_index(struct program *type, int inherit_no, int parent_level)
   struct object *o,*magic;
   struct program *p;
 
-  o=fp->current_object;
+  o=Pike_fp->current_object;
   if(!o) error("Illegal magic index call.\n");
   
-  inherit=INHERIT_FROM_INT(fp->current_object->prog, fp->fun);
+  inherit=INHERIT_FROM_INT(Pike_fp->current_object->prog, Pike_fp->fun);
 
   while(parent_level--)
   {
diff --git a/src/opcodes.c b/src/opcodes.c
index 5818fd4c16..41dcf2faa8 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -26,7 +26,7 @@
 #include "bignum.h"
 #include "operators.h"
 
-RCSID("$Id: opcodes.c,v 1.76 2000/07/05 23:01:48 hubbe Exp $");
+RCSID("$Id: opcodes.c,v 1.77 2000/07/07 15:31:14 grubba Exp $");
 
 void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
 {
@@ -388,10 +388,10 @@ void o_cast(struct pike_string *type, INT32 run_time_type)
 	switch(sp[-1].type)
 	{
 	  case T_STRING:
-	    if(fp->pc)
+	    if(Pike_fp->pc)
 	    {
 	      INT32 lineno;
-	      push_text(get_line(fp->pc, fp->context.prog, &lineno));
+	      push_text(get_line(Pike_fp->pc, Pike_fp->context.prog, &lineno));
 	    }else{
 	      push_int(0);
 	    }
@@ -411,10 +411,10 @@ void o_cast(struct pike_string *type, INT32 run_time_type)
       switch(sp[-1].type)
       {
 	case T_STRING:
-	  if(fp->pc)
+	  if(Pike_fp->pc)
 	  {
 	    INT32 lineno;
-	    push_text(get_line(fp->pc, fp->context.prog, &lineno));
+	    push_text(get_line(Pike_fp->pc, Pike_fp->context.prog, &lineno));
 	  }else{
 	    push_int(0);
 	  }
diff --git a/src/security.c b/src/security.c
index d126d15513..02b394d783 100644
--- a/src/security.c
+++ b/src/security.c
@@ -83,7 +83,7 @@ static void f_call_with_creds(INT32 args)
 {
   struct object *o;
 
-  switch(sp[-args].type)
+  switch(Pike_sp[-args].type)
   {
     case T_INT:
       /* We might want allocate a bit for this so that we can
@@ -93,14 +93,14 @@ static void f_call_with_creds(INT32 args)
        * Indeed. Consider the case when this function is used as a callback.
        * /grubba 1999-07-12
        */
-      o=fp->current_object->prot;
+      o=Pike_fp->current_object->prot;
       break;
 
     case T_OBJECT:
-      o=sp[-args].u.object;
+      o=Pike_sp[-args].u.object;
       if(!CHECK_SECURITY(SECURITY_BIT_SECURITY) &&
-	 !(fp->current_object->prot && 
-	   (OBJ2CREDS(fp->current_object->prot)->may_always & SECURITY_BIT_SECURITY)))
+	 !(Pike_fp->current_object->prot && 
+	   (OBJ2CREDS(Pike_fp->current_object->prot)->may_always & SECURITY_BIT_SECURITY)))
 	error("call_with_creds: permission denied.\n");
       
       break;
@@ -122,10 +122,10 @@ static void f_call_with_creds(INT32 args)
   /* NOTE: curent_creds will be restored by the mega_apply() that called us.
    */
 
-  free_svalue(sp-2);
-  sp[-2]=sp[-1];
-  sp--;
-  dmalloc_touch_svalue(sp);
+  free_svalue(Pike_sp-2);
+  Pike_sp[-2]=Pike_sp[-1];
+  Pike_sp--;
+  dmalloc_touch_svalue(Pike_sp);
 }
 
 /*: <pikedoc type=txt>
@@ -296,7 +296,7 @@ static void creds_apply(INT32 args)
   {
     if(sp[-args].u.array->prot)
       free_object(sp[-args].u.array->prot);
-    add_ref( sp[-args].u.array->prot=fp->current_object );
+    add_ref( sp[-args].u.array->prot=Pike_fp->current_object );
   }else{
     error("creds->apply(): permission denied.\n");
   }
diff --git a/src/security.h b/src/security.h
index 4ef6b209f1..f957696ccc 100644
--- a/src/security.h
+++ b/src/security.h
@@ -120,7 +120,6 @@ struct pike_creds
   }
 
 
-extern struct object *Pike_interpreter.current_creds;
 /* Prototypes begin here */
 void init_pike_security(void);
 void exit_pike_security(void);
-- 
GitLab