guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile ChangeLog environment...


From: Dirk Herrmann
Subject: guile/guile-core/libguile ChangeLog environment...
Date: Wed, 01 Nov 2000 09:55:42 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Dirk Herrmann <address@hidden>  00/11/01 09:55:41

Modified files:
        guile-core/libguile: ChangeLog environments.c posix.c 

Log message:
        * environments.c:  Don't use '==' to compare SCM objects.
        * posix.c (scm_getgroups):  Don't create a redundant string object.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/ChangeLog.diff?r1=1.1158&r2=1.1159
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/environments.c.diff?r1=1.6&r2=1.7
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-core/libguile/posix.c.diff?r1=1.75&r2=1.76

Patches:
Index: guile/guile-core/libguile/ChangeLog
diff -u guile/guile-core/libguile/ChangeLog:1.1158 
guile/guile-core/libguile/ChangeLog:1.1159
--- guile/guile-core/libguile/ChangeLog:1.1158  Wed Nov  1 08:59:45 2000
+++ guile/guile-core/libguile/ChangeLog Wed Nov  1 09:55:41 2000
@@ -1,5 +1,12 @@
 2000-11-01  Dirk Herrmann  <address@hidden>
 
+       * environments.c (obarray_replace, obarray_retrieve,
+       obarray_remove):  Don't use '==' to compare SCM objects.
+
+       * posix.c (scm_getgroups):  Don't create a redundant string.
+
+2000-11-01  Dirk Herrmann  <address@hidden>
+
        * symbols.c (scm_sym2vcell, scm_sym2ovcell_soft,
        scm_intern_symbol, scm_unintern_symbol):  Symbol objects already
        hold their hash values, no need to recompute them.
Index: guile/guile-core/libguile/environments.c
diff -u guile/guile-core/libguile/environments.c:1.6 
guile/guile-core/libguile/environments.c:1.7
--- guile/guile-core/libguile/environments.c:1.6        Mon Oct  9 07:37:36 2000
+++ guile/guile-core/libguile/environments.c    Wed Nov  1 09:55:41 2000
@@ -545,7 +545,7 @@
   for (lsym = SCM_VELTS (obarray)[hash]; !SCM_NULLP (lsym); lsym = SCM_CDR 
(lsym))
     {
       SCM old_entry = SCM_CAR (lsym);
-      if (SCM_CAR (old_entry) == symbol)
+      if (SCM_EQ_P (SCM_CAR (old_entry), symbol))
        {
          SCM_SETCAR (lsym, new_entry);
          return old_entry;
@@ -571,7 +571,7 @@
   for (lsym = SCM_VELTS (obarray)[hash]; !SCM_NULLP (lsym); lsym = SCM_CDR 
(lsym))
     {
       SCM entry = SCM_CAR (lsym);
-      if (SCM_CAR (entry) == sym)
+      if (SCM_EQ_P (SCM_CAR (entry), sym))
        return entry;
     }
 
@@ -596,7 +596,7 @@
        lsym = *(lsymp = SCM_CDRLOC (lsym)))
     {
       SCM entry = SCM_CAR (lsym);
-      if (SCM_CAR (entry) == sym)
+      if (SCM_EQ_P (SCM_CAR (entry), sym))
        {
          *lsymp = SCM_CDR (lsym);
          return entry;
Index: guile/guile-core/libguile/posix.c
diff -u guile/guile-core/libguile/posix.c:1.75 
guile/guile-core/libguile/posix.c:1.76
--- guile/guile-core/libguile/posix.c:1.75      Mon Oct 30 03:42:26 2000
+++ guile/guile-core/libguile/posix.c   Wed Nov  1 09:55:41 2000
@@ -205,33 +205,27 @@
            "Returns a vector of integers representing the current 
supplimentary group IDs.")
 #define FUNC_NAME s_scm_getgroups
 {
-  SCM grps, ans;
-  int ngroups = getgroups (0, NULL);
-  if (!ngroups)
+  SCM ans;
+  int ngroups;
+  scm_sizet size;
+  GETGROUPS_T *groups;
+
+  ngroups = getgroups (0, NULL);
+  if (ngroups <= 0)
     SCM_SYSERROR;
-  SCM_NEWCELL(grps);
-  SCM_DEFER_INTS;
-  {
-    GETGROUPS_T *groups;
-    int val;
+
+  size = ngroups * sizeof (GETGROUPS_T);
+  groups = scm_must_malloc (size, FUNC_NAME);
+  getgroups (ngroups, groups);
+
+  ans = scm_make_vector (SCM_MAKINUM (ngroups), SCM_UNDEFINED);
+  while (--ngroups >= 0) 
+    SCM_VELTS (ans) [ngroups] = SCM_MAKINUM (groups [ngroups]);
+
+  scm_must_free (groups);
+  scm_done_free (size);
 
-    groups = SCM_MUST_MALLOC_TYPE_NUM(GETGROUPS_T,ngroups);                    
                    
-    val = getgroups(ngroups, groups);
-    if (val < 0)
-      {
-       int en = errno;
-       scm_must_free((char *)groups);
-       errno = en;
-       SCM_SYSERROR;
-      }
-    SCM_SETCHARS(grps, groups);        /* set up grps as a GC protect */
-    SCM_SETLENGTH(grps, 0L + ngroups * sizeof(GETGROUPS_T), scm_tc7_string);
-    ans = scm_make_vector (SCM_MAKINUM(ngroups), SCM_UNDEFINED);
-    while (--ngroups >= 0) SCM_VELTS(ans)[ngroups] = 
SCM_MAKINUM(groups[ngroups]);
-    SCM_SETCHARS(grps, groups);        /* to make sure grps stays around. */
-    SCM_ALLOW_INTS;
-    return ans;
-  }
+  return ans;
 }
 #undef FUNC_NAME  
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]