From 125ca1a11a53810ac311012352f5b0773fc2bbde Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 18 Oct 1999 09:03:16 +0000 Subject: 19991018 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/nkf/depend | 2 +- ext/nkf/nkf.c | 22 +++++----------------- ext/socket/extconf.rb | 5 +++++ ext/socket/socket.c | 2 ++ 4 files changed, 13 insertions(+), 18 deletions(-) (limited to 'ext') diff --git a/ext/nkf/depend b/ext/nkf/depend index 645bc869c8..13e32e6074 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 80d0d2e4be..cde0f7a9a6 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; } diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 47addfeff8..467c052a85 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -160,6 +160,10 @@ if try_run(< #include +#ifndef AF_LOCAL +#define AF_LOCAL AF_UNIX +#endif + main() { int passive, gaierr, inet4 = 0, inet6 = 0; @@ -176,6 +180,7 @@ main() goto bad; } for (ai = aitop; ai; ai = ai->ai_next) { + if (ai->ai_family == AF_LOCAL) continue; if (ai->ai_addr == NULL || ai->ai_addrlen == 0 || getnameinfo(ai->ai_addr, ai->ai_addrlen, diff --git a/ext/socket/socket.c b/ext/socket/socket.c index a1d707122e..408257eeb6 100644 --- a/ext/socket/socket.c +++ b/ext/socket/socket.c @@ -890,7 +890,9 @@ tcp_s_gethostbyname(obj, host) struct sockaddr_in6 sin6; MEMZERO(&sin6, struct sockaddr_in6, 1); sin6.sin6_family = AF_INET; +#ifdef SIN6_LEN sin6.sin6_len = sizeof(sin6); +#endif memcpy((char *) &sin6.sin6_addr, *pch, h->h_length); h = gethostbyaddr((char *)&sin6.sin6_addr, sizeof(sin6.sin6_addr), -- cgit v1.2.3