Cancel some unnecessary GC_PROTECTs.

This commit is contained in:
mainzelm 2002-02-14 14:00:27 +00:00
parent 64221a6b95
commit 1b2096cfb4
2 changed files with 22 additions and 34 deletions

View File

@ -19,11 +19,10 @@ s48_value open_dir(s48_value sch_dirname)
struct dirent *dirent; struct dirent *dirent;
DIR *d; DIR *d;
s48_value dirlist = S48_NULL; s48_value dirlist = S48_NULL;
s48_value sch_d_name = S48_UNSPECIFIC;
S48_DECLARE_GC_PROTECT(2); S48_DECLARE_GC_PROTECT(1);
S48_GC_PROTECT_2(dirlist, sch_d_name); S48_GC_PROTECT_1(dirlist);
if( NULL == (d = opendir(s48_extract_string (sch_dirname))) ) if( NULL == (d = opendir(s48_extract_string (sch_dirname))) )
s48_raise_os_error_1 (errno, sch_dirname); s48_raise_os_error_1 (errno, sch_dirname);
@ -32,8 +31,8 @@ s48_value open_dir(s48_value sch_dirname)
if((strcmp(dirent->d_name,".") == 0) || (strcmp(dirent->d_name,"..") == 0)) if((strcmp(dirent->d_name,".") == 0) || (strcmp(dirent->d_name,"..") == 0))
continue; continue;
sch_d_name = s48_enter_string(dirent->d_name); dirlist = s48_cons (s48_enter_string (dirent->d_name),
dirlist = s48_cons (sch_d_name, dirlist); dirlist);
} }
if (closedir(d) == -1) if (closedir(d) == -1)

View File

@ -523,11 +523,9 @@ s48_value host_ent2host_info (struct hostent * host)
{ {
s48_value host_info = S48_FALSE; s48_value host_info = S48_FALSE;
s48_value list = S48_FALSE; s48_value list = S48_FALSE;
s48_value sch_h_aliases = S48_UNSPECIFIC;
s48_value sch_h_addr_elt = S48_UNSPECIFIC;
long * ptr; long * ptr;
int i; int i;
S48_DECLARE_GC_PROTECT (4); S48_DECLARE_GC_PROTECT (2);
if(host==NULL) if(host==NULL)
{ {
@ -540,7 +538,7 @@ s48_value host_ent2host_info (struct hostent * host)
host_info_type_binding = s48_get_imported_binding ("host-info-type"); host_info_type_binding = s48_get_imported_binding ("host-info-type");
} }
S48_GC_PROTECT_4 (host_info, list, sch_h_aliases, sch_h_addr_elt); S48_GC_PROTECT_2 (host_info, list);
host_info = s48_make_record (host_info_type_binding); host_info = s48_make_record (host_info_type_binding);
S48_RECORD_SET (host_info, 0, s48_enter_string (host->h_name)); S48_RECORD_SET (host_info, 0, s48_enter_string (host->h_name));
@ -550,8 +548,7 @@ s48_value host_ent2host_info (struct hostent * host)
i = 0; i = 0;
while (*ptr) while (*ptr)
{ {
sch_h_aliases = s48_enter_string (host->h_aliases[i]); list = s48_cons (s48_enter_string (host->h_aliases[i]), list);
list = s48_cons (sch_h_aliases, list);
ptr++; ptr++;
i ++; i ++;
} }
@ -563,11 +560,9 @@ s48_value host_ent2host_info (struct hostent * host)
i = 0; i = 0;
while (*ptr) while (*ptr)
{ {
sch_h_addr_elt =
s48_enter_unsigned_integer (ntohl ((unsigned long) *(long *)(host->h_addr_list[i])));
list = list =
s48_cons (sch_h_addr_elt, list); s48_cons (s48_enter_unsigned_integer (ntohl ((unsigned long) *(long *)(host->h_addr_list[i]))),
list);
ptr++; ptr++;
i++; i++;
} }
@ -614,10 +609,9 @@ s48_value netent2net_info(struct netent *net)
{ {
s48_value network_info = S48_FALSE; s48_value network_info = S48_FALSE;
s48_value list = S48_FALSE; s48_value list = S48_FALSE;
s48_value sch_n_alias = S48_UNSPECIFIC;
long * ptr; long * ptr;
int i; int i;
S48_DECLARE_GC_PROTECT (3); S48_DECLARE_GC_PROTECT (2);
if (net==NULL) return S48_FALSE; if (net==NULL) return S48_FALSE;
@ -627,7 +621,7 @@ s48_value netent2net_info(struct netent *net)
network_info_type_binding = network_info_type_binding =
s48_get_imported_binding ("network-info-type"); s48_get_imported_binding ("network-info-type");
} }
S48_GC_PROTECT_3 (network_info, list, sch_n_alias); S48_GC_PROTECT_2 (network_info, list);
network_info = s48_make_record (network_info_type_binding); network_info = s48_make_record (network_info_type_binding);
S48_RECORD_SET (network_info, 0, s48_enter_string (net->n_name)); S48_RECORD_SET (network_info, 0, s48_enter_string (net->n_name));
@ -636,9 +630,8 @@ s48_value netent2net_info(struct netent *net)
list = S48_NULL; list = S48_NULL;
i = 0; i = 0;
while (*ptr) while (*ptr)
{ {
sch_n_alias = s48_enter_string (net->n_aliases[i]); list = s48_cons (s48_enter_string (net->n_aliases[i]), list);
list = s48_cons (sch_n_alias, list);
ptr++; ptr++;
i++; i++;
} }
@ -677,10 +670,9 @@ s48_value servent2service_info(struct servent *serv)
{ {
s48_value service_info = S48_FALSE; s48_value service_info = S48_FALSE;
s48_value list = S48_FALSE; s48_value list = S48_FALSE;
s48_value sch_s_alias = S48_UNSPECIFIC;
long * ptr; long * ptr;
int i; int i;
S48_DECLARE_GC_PROTECT (3); S48_DECLARE_GC_PROTECT (2);
if (serv==NULL) return S48_FALSE; if (serv==NULL) return S48_FALSE;
@ -690,7 +682,7 @@ s48_value servent2service_info(struct servent *serv)
service_info_type_binding = service_info_type_binding =
s48_get_imported_binding ("service-info-type"); s48_get_imported_binding ("service-info-type");
} }
S48_GC_PROTECT_3 (service_info, list, sch_s_alias); S48_GC_PROTECT_2 (service_info, list);
service_info = s48_make_record (service_info_type_binding); service_info = s48_make_record (service_info_type_binding);
@ -701,10 +693,9 @@ s48_value servent2service_info(struct servent *serv)
i = 0; i = 0;
while (*ptr) while (*ptr)
{ {
sch_s_alias = s48_enter_string (serv->s_aliases[i]); list = s48_cons (s48_enter_string (serv->s_aliases[i]), list);
list = s48_cons (sch_s_alias, list); ptr++;
ptr++; i++;
i++;
} }
S48_RECORD_SET (service_info, 1, list); S48_RECORD_SET (service_info, 1, list);
@ -755,7 +746,6 @@ s48_value protoent2protocol_info(struct protoent *proto)
{ {
s48_value protocol_info = S48_FALSE; s48_value protocol_info = S48_FALSE;
s48_value list = S48_FALSE; s48_value list = S48_FALSE;
s48_value sch_p_alias = S48_UNSPECIFIC;
long * ptr; long * ptr;
int i; int i;
S48_DECLARE_GC_PROTECT (2); S48_DECLARE_GC_PROTECT (2);
@ -768,7 +758,7 @@ s48_value protoent2protocol_info(struct protoent *proto)
protocol_info_type_binding = protocol_info_type_binding =
s48_get_imported_binding ("protocol-info-type"); s48_get_imported_binding ("protocol-info-type");
} }
S48_GC_PROTECT_3 (protocol_info, list, sch_p_alias); S48_GC_PROTECT_2 (protocol_info, list);
protocol_info = s48_make_record (protocol_info_type_binding); protocol_info = s48_make_record (protocol_info_type_binding);
@ -779,10 +769,9 @@ s48_value protoent2protocol_info(struct protoent *proto)
i = 0; i = 0;
while (*ptr) while (*ptr)
{ {
sch_p_alias = s48_enter_string (proto->p_aliases[i]); list = s48_cons (s48_enter_string (proto->p_aliases[i]), list);
list = s48_cons (sch_p_alias, list); ptr++;
ptr++; i++;
i++;
} }
S48_RECORD_SET (protocol_info, 1, list); S48_RECORD_SET (protocol_info, 1, list);