(scm_resolv_error): don't cause an exception while
[bpt/guile.git] / libguile / net_db.c
index 7076ce4..5395991 100644 (file)
@@ -110,7 +110,7 @@ static void scm_resolv_error (const char *subr, SCM bad_value)
 #ifdef HAVE_HSTRERROR
       errmsg = (const char *) hstrerror (h_errno);
 #endif
-      scm_error (key, subr, errmsg, scm_cons (bad_value, SCM_EOL), SCM_EOL);
+      scm_error (key, subr, errmsg, SCM_BOOL_F, SCM_EOL);
     }
 }
 
@@ -171,8 +171,8 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0,
   
   SCM_VECTOR_SET(result, 0, scm_mem2string (entry->h_name, strlen (entry->h_name)));
   SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->h_aliases));
-  SCM_VECTOR_SET(result, 2, SCM_I_MAKINUM (entry->h_addrtype + 0L));
-  SCM_VECTOR_SET(result, 3, SCM_I_MAKINUM (entry->h_length + 0L));
+  SCM_VECTOR_SET(result, 2, scm_from_int (entry->h_addrtype));
+  SCM_VECTOR_SET(result, 3, scm_from_int (entry->h_length));
   if (sizeof (struct in_addr) != entry->h_length)
     {
       SCM_VECTOR_SET(result, 4, SCM_BOOL_F);
@@ -182,7 +182,7 @@ SCM_DEFINE (scm_gethost, "gethost", 0, 1, 0,
   while (i--)
     {
       inad = *(struct in_addr *) argv[i];
-      lst = scm_cons (scm_ulong2num (ntohl (inad.s_addr)), lst);
+      lst = scm_cons (scm_from_ulong (ntohl (inad.s_addr)), lst);
     }
   SCM_VECTOR_SET(result, 4, lst);
   return result;
@@ -239,8 +239,8 @@ SCM_DEFINE (scm_getnet, "getnet", 0, 1, 0,
     SCM_SYSERROR_MSG ("no such network ~A", scm_list_1 (net), errno);
   SCM_VECTOR_SET(result, 0, scm_mem2string (entry->n_name, strlen (entry->n_name)));
   SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->n_aliases));
-  SCM_VECTOR_SET(result, 2, SCM_I_MAKINUM (entry->n_addrtype + 0L));
-  SCM_VECTOR_SET(result, 3, scm_ulong2num (entry->n_net + 0L));
+  SCM_VECTOR_SET(result, 2, scm_from_int (entry->n_addrtype));
+  SCM_VECTOR_SET(result, 3, scm_from_ulong (entry->n_net));
   return result;
 }
 #undef FUNC_NAME
@@ -285,7 +285,7 @@ SCM_DEFINE (scm_getproto, "getproto", 0, 1, 0,
     SCM_SYSERROR_MSG ("no such protocol ~A", scm_list_1 (protocol), errno);
   SCM_VECTOR_SET(result, 0, scm_mem2string (entry->p_name, strlen (entry->p_name)));
   SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->p_aliases));
-  SCM_VECTOR_SET(result, 2, SCM_I_MAKINUM (entry->p_proto + 0L));
+  SCM_VECTOR_SET(result, 2, scm_from_int (entry->p_proto));
   return result;
 }
 #undef FUNC_NAME
@@ -299,7 +299,7 @@ scm_return_entry (struct servent *entry)
 
   SCM_VECTOR_SET(result, 0, scm_mem2string (entry->s_name, strlen (entry->s_name)));
   SCM_VECTOR_SET(result, 1, scm_makfromstrs (-1, entry->s_aliases));
-  SCM_VECTOR_SET(result, 2, SCM_I_MAKINUM (ntohs (entry->s_port) + 0L));
+  SCM_VECTOR_SET(result, 2, scm_from_uint16 (ntohs (entry->s_port)));
   SCM_VECTOR_SET(result, 3, scm_mem2string (entry->s_proto, strlen (entry->s_proto)));
   return result;
 }