unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Stephen Compall <s11@member.fsf.org>
Subject: [PATCH]class-of error when goops hasn't been loaded
Date: 23 Jan 2004 23:22:22 -0600	[thread overview]
Message-ID: <xfyk73hapkh.fsf@csserver.evansville.edu> (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

             reply	other threads:[~2004-01-24  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-24  5:22 Stephen Compall [this message]
2004-02-17 22:24 ` [PATCH]class-of error when goops hasn't been loaded Marius Vollmer
2004-02-18  2:36   ` Stephen Compall
2004-02-18 22:18     ` Marius Vollmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xfyk73hapkh.fsf@csserver.evansville.edu \
    --to=s11@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).