summaryrefslogtreecommitdiff
path: root/ext/strscan
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-06 06:15:11 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-06 06:15:11 +0000
commit3b16f66bf7bb0b9d5a466d85544f71c9727ff4d3 (patch)
treeded08303dd0241dbbbb0d8c0130e0bb88e82e541 /ext/strscan
parent50c455507217045133f9ef3e9c5ac85cf68e6e79 (diff)
* ext/strscan/strscan.c (strscan_init_copy): struct re_registers must
not be bitwise copied. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/strscan')
-rw-r--r--ext/strscan/strscan.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index b60cdb8..db1a9c6 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -240,7 +240,13 @@ strscan_init_copy(vself, vorig)
Data_Get_Struct(vself, struct strscanner, self);
check_strscan(vorig);
Data_Get_Struct(vorig, struct strscanner, orig);
- memmove(self, orig, sizeof(struct strscanner));
+ if (self != orig) {
+ self->flags = orig->flags;
+ self->str = orig->str;
+ self->prev = orig->prev;
+ self->curr = orig->curr;
+ re_copy_registers(&self->regs, &orig->regs);
+ }
return vself;
}