cvsuser 04/04/21 05:17:52
Modified: src string.c
Log:
reset hashval for chopn; some cleanup and comments
Revision Changes Path
1.199 +17 -4 parrot/src/string.c
Index: string.c
===================================================================
RCS file: /cvs/public/parrot/src/string.c,v
retrieving revision 1.198
retrieving revision 1.199
diff -u -w -r1.198 -r1.199
--- string.c 21 Apr 2004 11:30:40 -0000 1.198
+++ string.c 21 Apr 2004 12:17:52 -0000 1.199
@@ -1,6 +1,6 @@
/*
Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-$Id: string.c,v 1.198 2004/04/21 11:30:40 leo Exp $
+$Id: string.c,v 1.199 2004/04/21 12:17:52 leo Exp $
=head1 NAME
@@ -320,8 +320,6 @@
Parrot_allocate_string(interpreter,
s, string_max_bytes(interpreter, s, capacity));
- s->strlen = s->bufused = 0;
-
return s;
}
@@ -345,6 +343,7 @@
temp = string_make_empty(interpreter, representation, needed_length);
string_append(interpreter, temp, s, s->obj.flags);
string_set(interpreter, s, temp);
+ s->hashval = 0;
/*
s->representation = temp->representation;
@@ -1393,6 +1392,7 @@
dest->bufused = string_max_bytes(interpreter, dest, true_length);
dest->strlen = true_length;
+ dest->hashval = 0;
if (d != NULL) {
*d = dest;
@@ -1591,6 +1591,7 @@
s->strlen = new_length;
s->bufused = string_max_bytes(interpreter, s, new_length);
+ s->hashval = 0;
return s;
}
@@ -1767,7 +1768,19 @@
else if (s1->hashval != s2->hashval && s1->hashval && s2->hashval) {
return 1;
}
- else if (!s1->strlen && !s2->strlen) {
+ else if (!s1->strlen) { /* s2->strlen is the same here */
+ return 0;
+ }
+
+ else if (s1->strstart == s2->strstart) { /* COWed strings */
+ /*
+ * XXX when compiled -O3 this added compare makes suddenly
+ * t/pmc/threads 6, 8-9 fail with --gc-debug
+ * It segfaults in thread.c:67 with a destroyed interpreter
+ * gcc error?
+ *
+ * -leo
+ */
return 0;
}