summaryrefslogtreecommitdiff
path: root/ext/nkf
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-18 09:03:16 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-10-18 09:03:16 +0000
commit125ca1a11a53810ac311012352f5b0773fc2bbde (patch)
tree2b9ac558373e9742e475be19fed72bfb7924a0f9 /ext/nkf
parent40a3f601e43a137e56b2c28454ffb6ce79d7ec7e (diff)
19991018
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf')
-rw-r--r--ext/nkf/depend2
-rw-r--r--ext/nkf/nkf.c22
2 files changed, 6 insertions, 18 deletions
diff --git a/ext/nkf/depend b/ext/nkf/depend
index 645bc86..13e32e6 100644
--- a/ext/nkf/depend
+++ b/ext/nkf/depend
@@ -1 +1 @@
-nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h nkf1.7/nkf.c
+nkf.o : nkf.c $(hdrdir)/ruby.h $(topdir)/config.h $(hdrdir)/defines.h $(srcdir)/nkf1.7/nkf.c
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 80d0d2e..cde0f7a 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -31,14 +31,12 @@ rb_nkf_putchar(c)
{
if (output_ctr >= o_len) {
o_len += incsize;
- rb_str_cat(dst, "", incsize);
+ rb_str_cat(dst, 0, incsize);
+ output = RSTRING(dst)->ptr;
incsize *= 2;
}
-
output[output_ctr++] = c;
-/*
-printf("[[%c][%c][%d]]\n", c, output[output_ctr - 1], output_ctr);
-*/
+
return c;
}
@@ -78,18 +76,8 @@ rb_nkf_kconv(obj, opt, src)
}
kanji_convert(NULL);
- if (output_ctr > 0) output_ctr--;
- if (output[output_ctr] == '\0') {
-/*
-printf("([%c][%d])\n", output[output_ctr], output_ctr);
-*/
- RSTRING(dst)->len = output_ctr;
- } else {
-/*
-printf("<[%c][%d]>\n", output[output_ctr], output_ctr);
-*/
- RSTRING(dst)->len = output_ctr + 1;
- }
+ RSTRING(dst)->ptr[output_ctr] = '\0';
+ RSTRING(dst)->len = output_ctr;
return dst;
}