* gh.h: Don't take the address of a SCM value.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Mon, 5 Jun 2000 12:09:35 +0000 (12:09 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Mon, 5 Jun 2000 12:09:35 +0000 (12:09 +0000)
* sort.c: Don't take the address of SCM_CAR, use SCM_CARLOC instead.

libguile/ChangeLog
libguile/gc.h
libguile/sort.c

index 39f9235..f7cff9f 100644 (file)
@@ -1,3 +1,12 @@
+2000-06-05  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * gc.h (SCM_CARLOC, SCM_CDRLOC):  Don't take the address of a SCM
+       value.
+
+       * sort.c (scm_sorted_p, scm_merge, scm_merge_list_x,
+       scm_merge_list_step):  Don't take the address of SCM_CAR.  Use
+       SCM_CARLOC instead.  Thanks to Bernard Urban for the bug report.
+
 2000-06-05  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * boolean.h (SCM_TRUE_P):  Removed, as people might use it as a
index 70309a9..bebfeb9 100644 (file)
@@ -134,8 +134,8 @@ typedef scm_cell * SCM_CELLPTR;
   (SCM_SETCDR ((x), SCM_PACK (SCM_UNPACK (SCM_CDR (x)) | (y))))
 
 #define SCM_CELL_WORD_LOC(x, n) (&SCM_CELL_WORD (x, n))
-#define SCM_CARLOC(x) (&SCM_PACK (((scm_bits_t *) SCM2PTR (x)) [0]))
-#define SCM_CDRLOC(x) (&SCM_PACK (((scm_bits_t *) SCM2PTR (x)) [1]))
+#define SCM_CARLOC(x) ((SCM *) (&(((scm_bits_t *) SCM2PTR (x)) [0])))
+#define SCM_CDRLOC(x) ((SCM *) (&(((scm_bits_t *) SCM2PTR (x)) [1])))
 
 
 /* SCM_PTR_LT and friends define how to compare two SCM_CELLPTRs (which may
index d4b543e..91f79f2 100644 (file)
@@ -485,7 +485,7 @@ SCM_DEFINE (scm_sorted_p, "sorted?", 2, 0, 0,
       j = len - 1;
       while (j > 0)
        {
-         if ((*cmp) (less, &SCM_CAR(rest), &item))
+         if ((*cmp) (less, SCM_CARLOC(rest), &item))
            return SCM_BOOL_F;
          else
            {
@@ -555,7 +555,7 @@ SCM_DEFINE (scm_merge, "merge", 3, 0, 0,
     {
       SCM_VALIDATE_NONEMPTYLIST_COPYLEN (1,alist,alen);
       SCM_VALIDATE_NONEMPTYLIST_COPYLEN (2,blist,blen);
-      if ((*cmp) (less, &SCM_CAR (blist), &SCM_CAR (alist)))
+      if ((*cmp) (less, SCM_CARLOC (blist), SCM_CARLOC (alist)))
        {
          build = scm_cons (SCM_CAR (blist), SCM_EOL);
          blist = SCM_CDR (blist);
@@ -570,7 +570,7 @@ SCM_DEFINE (scm_merge, "merge", 3, 0, 0,
       last = build;
       while ((alen > 0) && (blen > 0))
        {
-         if ((*cmp) (less, &SCM_CAR (blist), &SCM_CAR (alist)))
+         if ((*cmp) (less, SCM_CARLOC (blist), SCM_CARLOC (alist)))
            {
              SCM_SETCDR (last, scm_cons (SCM_CAR (blist), SCM_EOL));
              blist = SCM_CDR (blist);
@@ -607,7 +607,7 @@ scm_merge_list_x (SCM alist, SCM blist,
     return alist;
   else
     {
-      if ((*cmp) (less, &SCM_CAR (blist), &SCM_CAR (alist)))
+      if ((*cmp) (less, SCM_CARLOC (blist), SCM_CARLOC (alist)))
        {
          build = blist;
          blist = SCM_CDR (blist);
@@ -622,7 +622,7 @@ scm_merge_list_x (SCM alist, SCM blist,
       last = build;
       while ((alen > 0) && (blen > 0))
        {
-         if ((*cmp) (less, &SCM_CAR (blist), &SCM_CAR (alist)))
+         if ((*cmp) (less, SCM_CARLOC (blist), SCM_CARLOC (alist)))
            {
              SCM_SETCDR (last, blist);
              blist = SCM_CDR (blist);
@@ -698,8 +698,8 @@ scm_merge_list_step (SCM * seq,
       SCM_SETCDR (rest, SCM_EOL);
       if ((*cmp) (less, &y, &x))
        {
-         SCM_CAR (p) = y;
-         SCM_CAR (rest) = x;
+         SCM_SETCAR (p, y);
+         SCM_SETCAR (rest, x);
        }
       return p;
     }