[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/alloc.c
From: |
Kim F . Storm |
Subject: |
[Emacs-diffs] Changes to emacs/src/alloc.c |
Date: |
Wed, 09 Nov 2005 18:14:12 -0500 |
Index: emacs/src/alloc.c
diff -c emacs/src/alloc.c:1.381 emacs/src/alloc.c:1.382
*** emacs/src/alloc.c:1.381 Thu Nov 3 21:11:20 2005
--- emacs/src/alloc.c Wed Nov 9 23:14:12 2005
***************
*** 4484,4493 ****
#endif
}
-
#endif /* GC_MARK_STACK != 0 */
/***********************************************************************
Pure Storage Management
--- 4484,4562 ----
#endif
}
#endif /* GC_MARK_STACK != 0 */
+
+ /* Return 1 if OBJ is a valid lisp object.
+ Return 0 if OBJ is NOT a valid lisp object.
+ Return -1 if we cannot validate OBJ.
+ */
+
+ int
+ valid_lisp_object_p (obj)
+ Lisp_Object obj;
+ {
+ #if !GC_MARK_STACK
+ /* Cannot determine this. */
+ return -1;
+ #else
+ void *p;
+ struct mem_node *m;
+
+ if (INTEGERP (obj))
+ return 1;
+
+ p = (void *) XPNTR (obj);
+
+ if (PURE_POINTER_P (p))
+ return 1;
+
+ m = mem_find (p);
+
+ if (m == MEM_NIL)
+ return 0;
+
+ switch (m->type)
+ {
+ case MEM_TYPE_NON_LISP:
+ return 0;
+
+ case MEM_TYPE_BUFFER:
+ return live_buffer_p (m, p);
+
+ case MEM_TYPE_CONS:
+ return live_cons_p (m, p);
+
+ case MEM_TYPE_STRING:
+ return live_string_p (m, p);
+
+ case MEM_TYPE_MISC:
+ return live_misc_p (m, p);
+
+ case MEM_TYPE_SYMBOL:
+ return live_symbol_p (m, p);
+
+ case MEM_TYPE_FLOAT:
+ return live_float_p (m, p);
+
+ case MEM_TYPE_VECTOR:
+ case MEM_TYPE_PROCESS:
+ case MEM_TYPE_HASH_TABLE:
+ case MEM_TYPE_FRAME:
+ case MEM_TYPE_WINDOW:
+ return live_vector_p (m, p);
+
+ default:
+ break;
+ }
+
+ return 0;
+ #endif
+ }
+
+
+
/***********************************************************************
Pure Storage Management
***************
*** 4967,4973 ****
total += total_floats * sizeof (struct Lisp_Float);
total += total_intervals * sizeof (struct interval);
total += total_strings * sizeof (struct Lisp_String);
!
gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
}
else
--- 5036,5042 ----
total += total_floats * sizeof (struct Lisp_Float);
total += total_intervals * sizeof (struct interval);
total += total_strings * sizeof (struct Lisp_String);
!
gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
}
else