Skip to content

Commit 9a7e346

Browse files
committed
unix/modusocket: Remove #if MICROPY_SOCKET_EXTRA code blocks.
These defined couple of functions added during initial experimentation, which aren't part of MicroPython API and no longer used or needed.
1 parent f4059dc commit 9a7e346

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

ports/unix/modusocket.c

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@
6060
should be add to separate modules (C or Python level).
6161
*/
6262

63-
#define MICROPY_SOCKET_EXTRA (0)
64-
6563
// This type must "inherit" from mp_obj_fdfile_t, i.e. matching subset of
6664
// fields should have the same layout.
6765
typedef struct _mp_obj_socket_t {
@@ -382,26 +380,6 @@ const mp_obj_type_t mp_type_socket = {
382380
.locals_dict = (mp_obj_dict_t*)&usocket_locals_dict,
383381
};
384382

385-
#if MICROPY_SOCKET_EXTRA
386-
STATIC mp_obj_t mod_socket_htons(mp_obj_t arg) {
387-
return MP_OBJ_NEW_SMALL_INT(htons(MP_OBJ_SMALL_INT_VALUE(arg)));
388-
}
389-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_htons_obj, mod_socket_htons);
390-
391-
392-
STATIC mp_obj_t mod_socket_gethostbyname(mp_obj_t arg) {
393-
const char *s = mp_obj_str_get_str(arg);
394-
struct hostent *h = gethostbyname(s);
395-
if (h == NULL) {
396-
// CPython: socket.herror
397-
mp_raise_OSError(h_errno);
398-
}
399-
assert(h->h_length == 4);
400-
return mp_obj_new_int(*(int*)*h->h_addr_list);
401-
}
402-
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_socket_gethostbyname_obj, mod_socket_gethostbyname);
403-
#endif // MICROPY_SOCKET_EXTRA
404-
405383
#define BINADDR_MAX_LEN sizeof(struct in6_addr)
406384
STATIC mp_obj_t mod_socket_inet_pton(mp_obj_t family_in, mp_obj_t addr_in) {
407385
int family = mp_obj_get_int(family_in);
@@ -549,10 +527,6 @@ STATIC const mp_rom_map_elem_t mp_module_socket_globals_table[] = {
549527
{ MP_ROM_QSTR(MP_QSTR_inet_pton), MP_ROM_PTR(&mod_socket_inet_pton_obj) },
550528
{ MP_ROM_QSTR(MP_QSTR_inet_ntop), MP_ROM_PTR(&mod_socket_inet_ntop_obj) },
551529
{ MP_ROM_QSTR(MP_QSTR_sockaddr), MP_ROM_PTR(&mod_socket_sockaddr_obj) },
552-
#if MICROPY_SOCKET_EXTRA
553-
{ MP_ROM_QSTR(MP_QSTR_htons), MP_ROM_PTR(&mod_socket_htons_obj) },
554-
{ MP_ROM_QSTR(MP_QSTR_gethostbyname), MP_ROM_PTR(&mod_socket_gethostbyname_obj) },
555-
#endif
556530

557531
#define C(name) { MP_ROM_QSTR(MP_QSTR_ ## name), MP_ROM_INT(name) }
558532
C(AF_UNIX),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy