OSDN Git Service

Imported following change from ruby.
authorNARUSE, Yui <naruse@users.sourceforge.jp>
Tue, 20 Jan 2009 01:23:05 +0000 (10:23 +0900)
committerNARUSE, Yui <naruse@users.sourceforge.jp>
Tue, 20 Jan 2009 01:23:05 +0000 (10:23 +0900)
r21679 | usa | 2009-01-20 09:27:17 +0900 (Tue, 20 Jan 2009) | 5 lines

        * ext/nkf/nkf-utf8/nkf.c (nkf_buf_push): maybe a bug.

        * ext/nkf/nkf-utf8/nkf.c (options): no need to support help
          option.

nkf.c

diff --git a/nkf.c b/nkf.c
index d1d23eb..3222ffd 100644 (file)
--- a/nkf.c
+++ b/nkf.c
@@ -802,7 +802,7 @@ nkf_default_encoding()
 typedef struct {
     long capa;
     long len;
-    unsigned char *ptr;
+    nkf_char *ptr;
 } nkf_buf_t;
 
 static nkf_buf_t *
@@ -841,7 +841,7 @@ nkf_buf_clear(nkf_buf_t *buf)
 }
 
 static void
-nkf_buf_push(nkf_buf_t *buf, unsigned char c)
+nkf_buf_push(nkf_buf_t *buf, nkf_char c)
 {
     if (buf->capa <= buf->len) {
        exit(EXIT_FAILURE);
@@ -4263,7 +4263,7 @@ nfc_getc(FILE *f)
 
     if (c == EOF || c > 0xFF || (c & 0xc0) == 0x80) return c;
 
-    nkf_buf_push(buf, (unsigned char)c);
+    nkf_buf_push(buf, c);
     do {
        while (lower <= upper) {
            int mid = (lower+upper) / 2;
@@ -5842,10 +5842,12 @@ options(unsigned char *cp)
                cp_back = cp;
                cp = (unsigned char *)long_option[i].alias;
            }else{
+#ifndef PERL_XS
                if (strcmp(long_option[i].name, "help") == 0){
                    usage();
                    exit(EXIT_SUCCESS);
                }
+#endif
                if (strcmp(long_option[i].name, "ic=") == 0){
                    enc = nkf_enc_find((char *)p);
                    if (!enc) continue;