unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH]class-of error when goops hasn't been loaded
@ 2004-01-24  5:22 Stephen Compall
  2004-02-17 22:24 ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Compall @ 2004-01-24  5:22 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

Problem: class-of was returning some of various scm_class_* objects
when they hadn't been initialized, which caused segfault if you were
lucky.

Solution?: this patch has scm_class_boolean initially set to 0, and
tested on each call to class-of.  If it hasn't been set, class-of
throws goops-error.

The other way to do it would be to not register scm_class_of as
class-of until GOOPS is loaded.

--
Stephen Compall or s11 or sirian

TOO BAD YOU CAN'T BUY a voodoo globe so that you could make the earth spin
real fast and freak everybody out.
		-- Jack Handley, The New Mexican, 1988.

UFO Khaddafi FIPS140 encryption emc Firefly LLNL AIEWS fraud Ft. Bragg
asset lynch Skipjack explosion government


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: changes to libguile/objects.c --]
[-- Type: text/x-patch, Size: 994 bytes --]

--- /mdkhome/sirian/src/guile/guile-core/libguile/objects.c.~1.76.~	2003-11-19 07:30:56.000000000 -0600
+++ /mdkhome/sirian/src/guile/guile-core/libguile/objects.c	2004-01-23 23:09:43.000000000 -0600
@@ -44,7 +44,8 @@
 SCM scm_metaclass_operator;
 
 /* These variables are filled in by the object system when loaded. */
-SCM scm_class_boolean, scm_class_char, scm_class_pair;
+/* scm_class_boolean guaranteed to be 0 until that has happened. */
+SCM scm_class_boolean = 0, scm_class_char, scm_class_pair;
 SCM scm_class_procedure, scm_class_string, scm_class_symbol;
 SCM scm_class_procedure_with_setter, scm_class_primitive_generic;
 SCM scm_class_vector, scm_class_null;
@@ -62,6 +63,9 @@
 	    "Return the class of @var{x}.")
 #define FUNC_NAME s_scm_class_of
 {
+  if (!scm_class_boolean)	/* goops not loaded? */
+    scm_error (scm_str2symbol ("goops-error"), FUNC_NAME,
+	       "GOOPS has not been loaded", SCM_EOL, SCM_BOOL_F);
   switch (SCM_ITAG3 (x))
     {
     case scm_tc3_int_1:

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]class-of error when goops hasn't been loaded
  2004-01-24  5:22 [PATCH]class-of error when goops hasn't been loaded Stephen Compall
@ 2004-02-17 22:24 ` Marius Vollmer
  2004-02-18  2:36   ` Stephen Compall
  0 siblings, 1 reply; 4+ messages in thread
From: Marius Vollmer @ 2004-02-17 22:24 UTC (permalink / raw)
  Cc: guile-devel

Stephen Compall <s11@member.fsf.org> writes:

> The other way to do it would be to not register scm_class_of as
> class-of until GOOPS is loaded.

I like this variant better.  Are you willing to work on a patch?

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]class-of error when goops hasn't been loaded
  2004-02-17 22:24 ` Marius Vollmer
@ 2004-02-18  2:36   ` Stephen Compall
  2004-02-18 22:18     ` Marius Vollmer
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Compall @ 2004-02-18  2:36 UTC (permalink / raw)
  Cc: guile-devel

Marius Vollmer <mvo@zagadka.de> writes:

> Stephen Compall <s11@member.fsf.org> writes:
> 
> > The other way to do it would be to not register scm_class_of as
> > class-of until GOOPS is loaded.
> 
> I like this variant better.  Are you willing to work on a patch?

Me too.  I can do it on Thursday, when I need to do some other C stuff
anyway.

--
Stephen Compall or s11 or sirian

I guess the Little League is even littler than we thought.
		-- D. Cavett

diwn bootleg 9705 Samford Road Geraldton ANZUS monarchist mania SWAT
HAMASMOIS Semtex MDA Rubin UNSCOM class struggle AIMSX


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]class-of error when goops hasn't been loaded
  2004-02-18  2:36   ` Stephen Compall
@ 2004-02-18 22:18     ` Marius Vollmer
  0 siblings, 0 replies; 4+ messages in thread
From: Marius Vollmer @ 2004-02-18 22:18 UTC (permalink / raw)
  Cc: guile-devel

Stephen Compall <s11@member.fsf.org> writes:

> Marius Vollmer <mvo@zagadka.de> writes:
>
>> Stephen Compall <s11@member.fsf.org> writes:
>> 
>> > The other way to do it would be to not register scm_class_of as
>> > class-of until GOOPS is loaded.
>> 
>> I like this variant better.  Are you willing to work on a patch?
>
> Me too.  I can do it on Thursday, when I need to do some other C stuff
> anyway.

Excellent!

-- 
GPG: D5D4E405 - 2F9B BCCC 8527 692A 04E3  331E FAF8 226A D5D4 E405


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-18 22:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-24  5:22 [PATCH]class-of error when goops hasn't been loaded Stephen Compall
2004-02-17 22:24 ` Marius Vollmer
2004-02-18  2:36   ` Stephen Compall
2004-02-18 22:18     ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).