*** empty log message ***
[bpt/guile.git] / libguile / modules.c
index 6070638..7d578dc 100644 (file)
@@ -277,8 +277,7 @@ static SCM
 module_variable (SCM module, SCM sym)
 {
 #define SCM_BOUND_THING_P(b) \
-  (!SCM_FALSEP(b) && \
-   (!SCM_VARIABLEP(b) || !SCM_UNBNDP (SCM_VARIABLE_REF (b))))
+  (SCM_VARIABLEP (b) && !SCM_UNBNDP (SCM_VARIABLE_REF (b)))
 
   /* 1. Check module obarray */
   SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (module), sym, SCM_UNDEFINED);
@@ -395,30 +394,31 @@ SCM_DEFINE (scm_module_import_interface, "module-import-interface", 2, 0, 0,
 #define FUNC_NAME s_scm_module_import_interface
 {
 #define SCM_BOUND_THING_P(b) (!SCM_FALSEP (b))
+  SCM uses;
   SCM_VALIDATE_MODULE (SCM_ARG1, module);
   /* Search the use list */
-  SCM uses = SCM_MODULE_USES (module);
+  uses = SCM_MODULE_USES (module);
   while (SCM_CONSP (uses))
     {
-      SCM interface = SCM_CAR (uses);
+      SCM _interface = SCM_CAR (uses);
       /* 1. Check module obarray */
-      SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (interface), sym, SCM_BOOL_F);
+      SCM b = scm_hashq_ref (SCM_MODULE_OBARRAY (_interface), sym, SCM_BOOL_F);
       if (SCM_BOUND_THING_P (b))
-       return interface;
+       return _interface;
       {
-       SCM binder = SCM_MODULE_BINDER (interface);
+       SCM binder = SCM_MODULE_BINDER (_interface);
        if (!SCM_FALSEP (binder))
          /* 2. Custom binder */
          {
-           b = scm_call_3 (binder, interface, sym, SCM_BOOL_F);
+           b = scm_call_3 (binder, _interface, sym, SCM_BOOL_F);
            if (SCM_BOUND_THING_P (b))
-             return interface;
+             return _interface;
          }
       }
       /* 3. Search use list recursively. */
-      interface = scm_module_import_interface (interface, sym);
-      if (!SCM_FALSEP (interface))
-       return interface;
+      _interface = scm_module_import_interface (_interface, sym);
+      if (!SCM_FALSEP (_interface))
+       return _interface;
       uses = SCM_CDR (uses);
     }
   return SCM_BOOL_F;
@@ -567,6 +567,9 @@ scm_module_reverse_lookup (SCM module, SCM variable)
       obarray = SCM_MODULE_OBARRAY (module);
     }
 
+  if (!SCM_HASHTABLE_P (obarray))
+      return SCM_BOOL_F;
+
   /* XXX - We do not use scm_hash_fold here to avoid searching the
      whole obarray.  We should have a scm_hash_find procedure. */