From 7d93fb47964c52b79b2d5b7979fae0aaa8b6527b Mon Sep 17 00:00:00 2001
From: Stephen Adams <edu/mit/csail/zurich/adams>
Date: Sun, 19 Nov 1995 19:30:17 +0000
Subject: [PATCH] Changed %PC-SAMPLE/SET-ZONE! to incorporate a comparison with
 the pre-existing value.

---
 v7/src/pcsample/pcsample.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/v7/src/pcsample/pcsample.c b/v7/src/pcsample/pcsample.c
index e100eaf5c..13fa90066 100644
--- a/v7/src/pcsample/pcsample.c
+++ b/v7/src/pcsample/pcsample.c
@@ -1,6 +1,6 @@
 /* -*-C-*-
 
-$Id: pcsample.c,v 1.3 1995/08/08 22:58:17 adams Exp $
+$Id: pcsample.c,v 1.4 1995/11/19 19:30:17 adams Exp $
 
 Copyright (c) 1990-1995 Massachusetts Institute of Technology
 
@@ -1452,13 +1452,18 @@ DEFINE_PRIMITIVE ("%PC-SAMPLE/SET-ZONE!",
 		  Prim_pc_sample_set_current_zone, 1, 1,
   "(index)\n\
 Set current pc-sampling zone to INDEX (a small exact integer), returning \
-the previous value.")
+the previous value if different, else #F if same.")
 {
     PRIMITIVE_HEADER(1);
     {
 	int  old_zone = current_zone;
-	current_zone = arg_index_integer (1, INITIAL_ZONE_LIMIT);
-	PRIMITIVE_RETURN (LONG_TO_FIXNUM(old_zone));
+	int  new_zone = arg_index_integer (1, INITIAL_ZONE_LIMIT);
+	if (old_zone == new_zone) {
+	    PRIMITIVE_RETURN (SHARP_F);
+	} else {
+	    current_zone = new_zone;
+	    PRIMITIVE_RETURN (LONG_TO_FIXNUM(old_zone));
+	}
     }
 }
 
-- 
2.25.1