diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 39f9235c4..f7cff9f2e 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,12 @@ +2000-06-05 Dirk Herrmann + + * 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 * boolean.h (SCM_TRUE_P): Removed, as people might use it as a diff --git a/libguile/gc.h b/libguile/gc.h index 70309a93f..bebfeb995 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -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 diff --git a/libguile/sort.c b/libguile/sort.c index d4b543ec9..91f79f274 100644 --- a/libguile/sort.c +++ b/libguile/sort.c @@ -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; }