projects
/
ruby-vorbistagger.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d1c49fe
)
Work with non NUL-terminated comments, too.
author
Tilman Sauerbeck
<tilman@code-monkey.de>
Thu, 28 Dec 2006 16:28:15 +0000
(17:28 +0100)
committer
Tilman Sauerbeck
<tilman@code-monkey.de>
Thu, 28 Dec 2006 16:28:35 +0000
(17:28 +0100)
ext/comments.c
patch
|
blob
|
history
diff --git
a/ext/comments.c
b/ext/comments.c
index 03a237b104f87d0fbfd77f78e165dae2a828fb34..03ba68009012eb329fb4f91b9402fe22bae36f48 100644
(file)
--- a/
ext/comments.c
+++ b/
ext/comments.c
@@
-41,14
+41,17
@@
comments_init (VALUE self, vcedit_state *state)
for (i = 0; i < vc->comments; i++) {
VALUE k, v, pair;
char *ptr, *content = vc->user_comments[i];
+ int k_len, v_len;
ptr = strchr (content, '=');
assert (ptr);
- k = rb_str_new (content, ptr - content);
+ k_len = ptr - content;
+ k = rb_str_new (content, k_len);
OBJ_FREEZE (k);
- v = rb_str_new2 (ptr + 1);
+ v_len = vc->comment_lengths[i] - k_len - 1;
+ v = rb_str_new (ptr + 1, v_len);
pair = rb_ary_new3 (2, k, v);
OBJ_FREEZE (pair);