diff options
author | Han-Wen Nienhuys <hanwen@lilypond.org> | 2002-07-20 14:08:34 +0000 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@lilypond.org> | 2002-07-20 14:08:34 +0000 |
commit | 34d19ef64368a8bac8a32f799b71dc05dd587654 (patch) | |
tree | bdf482155a8d561207b1a9c780f98ca666b77317 /libguile/net_db.c | |
parent | dd897aafbd218685874256405f740a0e9e1e7303 (diff) | |
download | guile-34d19ef64368a8bac8a32f799b71dc05dd587654.tar.gz |
2002-07-20 Han-Wen <hanwen@cs.uu.nl>
* *.c: add space after commas everywhere.
* *.c: use SCM_VECTOR_SET everywhere, where a vector is written.
Document cases where SCM_WRITABLE_VELTS() is used.
* vectors.h (SCM_VELTS): prepare for write barrier, and let
SCM_VELTS() return a const pointer
(SCM_VECTOR_SET): add macro.
* autogen.sh (mscripts): find and check version number of
autoconf. Complain if 2.53 is not found.
Diffstat (limited to 'libguile/net_db.c')
-rw-r--r-- | libguile/net_db.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/libguile/net_db.c b/libguile/net_db.c index ecb075c8b..12885642e 100644 --- a/libguile/net_db.c +++ b/libguile/net_db.c @@ -154,7 +154,7 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0, #define FUNC_NAME s_scm_gethost { SCM ans = scm_c_make_vector (5, SCM_UNSPECIFIED); - SCM *ve = SCM_VELTS (ans); + SCM *ve = SCM_WRITABLE_VELTS (ans); SCM lst = SCM_EOL; struct hostent *entry; struct in_addr inad; @@ -190,13 +190,13 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0, if (!entry) scm_resolv_error (FUNC_NAME, host); - ve[0] = scm_mem2string (entry->h_name, strlen (entry->h_name)); - ve[1] = scm_makfromstrs (-1, entry->h_aliases); - ve[2] = SCM_MAKINUM (entry->h_addrtype + 0L); - ve[3] = SCM_MAKINUM (entry->h_length + 0L); + SCM_VECTOR_SET(ans, 0, scm_mem2string (entry->h_name, strlen (entry->h_name))); + SCM_VECTOR_SET(ans, 1, scm_makfromstrs (-1, entry->h_aliases)); + SCM_VECTOR_SET(ans, 2, SCM_MAKINUM (entry->h_addrtype + 0L)); + SCM_VECTOR_SET(ans, 3, SCM_MAKINUM (entry->h_length + 0L)); if (sizeof (struct in_addr) != entry->h_length) { - ve[4] = SCM_BOOL_F; + SCM_VECTOR_SET(ans, 4, SCM_BOOL_F); return ans; } for (argv = entry->h_addr_list; argv[i]; i++); @@ -205,7 +205,7 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0, inad = *(struct in_addr *) argv[i]; lst = scm_cons (scm_ulong2num (ntohl (inad.s_addr)), lst); } - ve[4] = lst; + SCM_VECTOR_SET(ans, 4, lst); return ans; } #undef FUNC_NAME @@ -237,7 +237,8 @@ SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0, struct netent *entry; ans = scm_c_make_vector (4, SCM_UNSPECIFIED); - ve = SCM_VELTS (ans); + ve = SCM_WRITABLE_VELTS (ans); + if (SCM_UNBNDP (net)) { entry = getnetent (); @@ -261,10 +262,10 @@ SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0, } if (!entry) SCM_SYSERROR_MSG ("no such network ~A", scm_list_1 (net), errno); - ve[0] = scm_mem2string (entry->n_name, strlen (entry->n_name)); - ve[1] = scm_makfromstrs (-1, entry->n_aliases); - ve[2] = SCM_MAKINUM (entry->n_addrtype + 0L); - ve[3] = scm_ulong2num (entry->n_net + 0L); + SCM_VECTOR_SET(ans, 0, scm_mem2string (entry->n_name, strlen (entry->n_name))); + SCM_VECTOR_SET(ans, 1, scm_makfromstrs (-1, entry->n_aliases)); + SCM_VECTOR_SET(ans, 2, SCM_MAKINUM (entry->n_addrtype + 0L)); + SCM_VECTOR_SET(ans, 3, scm_ulong2num (entry->n_net + 0L)); return ans; } #undef FUNC_NAME @@ -286,7 +287,7 @@ SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0, struct protoent *entry; ans = scm_c_make_vector (3, SCM_UNSPECIFIED); - ve = SCM_VELTS (ans); + ve = SCM_WRITABLE_VELTS (ans); if (SCM_UNBNDP (protocol)) { entry = getprotoent (); @@ -310,9 +311,9 @@ SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0, } if (!entry) SCM_SYSERROR_MSG ("no such protocol ~A", scm_list_1 (protocol), errno); - ve[0] = scm_mem2string (entry->p_name, strlen (entry->p_name)); - ve[1] = scm_makfromstrs (-1, entry->p_aliases); - ve[2] = SCM_MAKINUM (entry->p_proto + 0L); + SCM_VECTOR_SET(ans, 0, scm_mem2string (entry->p_name, strlen (entry->p_name))); + SCM_VECTOR_SET(ans, 1, scm_makfromstrs (-1, entry->p_aliases)); + SCM_VECTOR_SET(ans, 2, SCM_MAKINUM (entry->p_proto + 0L)); return ans; } #undef FUNC_NAME @@ -326,11 +327,11 @@ scm_return_entry (struct servent *entry) SCM *ve; ans = scm_c_make_vector (4, SCM_UNSPECIFIED); - ve = SCM_VELTS (ans); - ve[0] = scm_mem2string (entry->s_name, strlen (entry->s_name)); - ve[1] = scm_makfromstrs (-1, entry->s_aliases); - ve[2] = SCM_MAKINUM (ntohs (entry->s_port) + 0L); - ve[3] = scm_mem2string (entry->s_proto, strlen (entry->s_proto)); + ve = SCM_WRITABLE_VELTS (ans); + SCM_VECTOR_SET(ans, 0, scm_mem2string (entry->s_name, strlen (entry->s_name))); + SCM_VECTOR_SET(ans, 1, scm_makfromstrs (-1, entry->s_aliases)); + SCM_VECTOR_SET(ans, 2, SCM_MAKINUM (ntohs (entry->s_port) + 0L)); + SCM_VECTOR_SET(ans, 3, scm_mem2string (entry->s_proto, strlen (entry->s_proto))); return ans; } @@ -367,7 +368,7 @@ SCM_DEFINE (scm_getserv, "getserv", 0, 2, 0, } else { - SCM_VALIDATE_INUM (1,name); + SCM_VALIDATE_INUM (1, name); entry = getservbyport (htons (SCM_INUM (name)), SCM_STRING_CHARS (protocol)); } if (!entry) |