diff options
author | Guido van Rossum <guido@python.org> | 1999-09-09 15:42:59 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1999-09-09 15:42:59 (GMT) |
commit | a2e48552d28721eec0df75912d479f7d44c14d0a (patch) | |
tree | d286b72c6db1f0c3133ff89bf5a768acea0b1f90 /Modules | |
parent | a41c691371db36bc4868f08b71d617a78280b240 (diff) | |
download | cpython-a2e48552d28721eec0df75912d479f7d44c14d0a.zip cpython-a2e48552d28721eec0df75912d479f7d44c14d0a.tar.gz cpython-a2e48552d28721eec0df75912d479f7d44c14d0a.tar.bz2 |
It appears that inet_aton() doesn't really exist except in libresolv;
the proper function to call is inet_addr(). Since we already had code
to do that (for MS-Windows), this simplifies things a lot!
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/socketmodule.c | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index e64090e..93a3b09 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -1807,26 +1807,10 @@ binary format used in low-level network functions."; static PyObject* BUILD_FUNC_DEF_2(PySocket_inet_aton, PyObject *, self, PyObject *, args) { -#ifndef MS_WINDOWS - char *ip_addr; - struct in_addr packed_addr; - int err; - - if (!PyArg_Parse(args, "s", &ip_addr)) { - return NULL; - } - - err = inet_aton(ip_addr, &packed_addr); - - if (err == 0) { /* invalid address */ - PyErr_SetString(PySocket_Error, - "illegal IP address string passed to inet_aton"); - return NULL; - } +#ifndef INADDR_NONE +#define INADDR_NONE (-1) +#endif - return PyString_FromStringAndSize((char *) &packed_addr, - sizeof(packed_addr)); -#else /* MS_WINDOWS */ /* Have to use inet_addr() instead */ char *ip_addr; long packed_addr; @@ -1845,7 +1829,6 @@ BUILD_FUNC_DEF_2(PySocket_inet_aton, PyObject *, self, PyObject *, args) return PyString_FromStringAndSize((char *) &packed_addr, sizeof(packed_addr)); -#endif /* MS_WINDOWS */ } static char inet_ntoa_doc[] = |