Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2011-08-17 03:32:18 +0400
committerPierre Humblet <phumblet@phumblet.no-ip.org>2011-08-17 03:32:18 +0400
commit927761a42542d44a5016eb31e8b338cd64b169ce (patch)
treeb8582737da1cbb8e8e6a64330b3d8cee33d6cc10
parent833db5481f1f86745979d3ceda580c2d8fdd24a8 (diff)
2011-08-16 Pierre Humblet <Pierre.Humblet@ieee.org>
* net.cc (gethostby_helper): Remove DEBUGGING code from and streamline the second pass.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/net.cc67
2 files changed, 22 insertions, 50 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 315972e58..e2c178abd 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2011-08-16 Pierre Humblet <Pierre.Humblet@ieee.org>
+
+ * net.cc (gethostby_helper): Remove DEBUGGING code from and
+ streamline the second pass.
+
2011-08-16 Corinna Vinschen <corinna@vinschen.de>
* dlfcn.cc (dlopen): Reimplement RTLD_NODELETE for Windows 2000 using
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index eaea766ab..6b63f4b0d 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1198,57 +1198,34 @@ gethostby_helper (const char *name, const int af, const int type,
string_ptr = (char *) (ret->h_addr_list + address_count + 1);
/* Rescan the answers */
- ancount = alias_count + address_count; /* Valid records */
alias_count = address_count = 0;
+ prevptr->set_next (prevptr + 1);
- for (i = 0, curptr = anptr; i < ancount; i++, curptr = curptr->next ())
+ for (curptr = anptr; curptr <= prevptr; curptr = curptr->next ())
{
antype = curptr->type;
if (antype == ns_t_cname)
{
- complen = dn_expand (msg, eomsg, curptr->name (), string_ptr, string_size);
-#ifdef DEBUGGING
- if (complen != curptr->complen)
- goto debugging;
-#endif
+ dn_expand (msg, eomsg, curptr->name (), string_ptr, curptr->namelen1);
ret->h_aliases[alias_count++] = string_ptr;
- namelen1 = curptr->namelen1;
- string_ptr += namelen1;
- string_size -= namelen1;
- continue;
+ string_ptr += curptr->namelen1;
}
- if (antype == type)
+ else
+ {
+ if (address_count == 0)
{
- if (address_count == 0)
- {
- complen = dn_expand (msg, eomsg, curptr->name(), string_ptr, string_size);
-#ifdef DEBUGGING
- if (complen != curptr->complen)
- goto debugging;
-#endif
- ret->h_name = string_ptr;
- namelen1 = curptr->namelen1;
- string_ptr += namelen1;
- string_size -= namelen1;
- }
- ret->h_addr_list[address_count++] = string_ptr;
- if (addrsize_in != addrsize_out)
- memcpy4to6 (string_ptr, curptr->data);
- else
- memcpy (string_ptr, curptr->data, addrsize_in);
- string_ptr += addrsize_out;
- string_size -= addrsize_out;
- continue;
+ dn_expand (msg, eomsg, curptr->name (), string_ptr, curptr->namelen1);
+ ret->h_name = string_ptr;
+ string_ptr += curptr->namelen1;
}
-#ifdef DEBUGGING
- /* Should not get here */
- goto debugging;
-#endif
+ ret->h_addr_list[address_count++] = string_ptr;
+ if (addrsize_in != addrsize_out)
+ memcpy4to6 (string_ptr, curptr->data);
+ else
+ memcpy (string_ptr, curptr->data, addrsize_in);
+ string_ptr += addrsize_out;
+ }
}
-#ifdef DEBUGGING
- if (string_size < 0)
- goto debugging;
-#endif
free (msg);
@@ -1263,16 +1240,6 @@ gethostby_helper (const char *name, const int af, const int type,
Should it be NO_RECOVERY ? */
h_errno = TRY_AGAIN;
return NULL;
-
-
-#ifdef DEBUGGING
- debugging:
- system_printf ("Please debug.");
- free (msg);
- free (ret);
- h_errno = NO_RECOVERY;
- return NULL;
-#endif
}
/* gethostbyname2: standards? */