@@ -63,7 +63,6 @@ static atom_t ATOM_infinite;
63
63
static functor_t FUNCTOR_error2 ;
64
64
static functor_t FUNCTOR_type_error2 ;
65
65
static functor_t FUNCTOR_domain_error2 ;
66
- static functor_t FUNCTOR_resource_error1 ;
67
66
static functor_t FUNCTOR_process_error2 ;
68
67
static functor_t FUNCTOR_system_error2 ;
69
68
static functor_t FUNCTOR_pipe1 ;
@@ -145,22 +144,6 @@ domain_error(term_t actual, const char *expected)
145
144
}
146
145
147
146
148
- static int
149
- resource_error (const char * resource )
150
- { term_t ex ;
151
-
152
- if ( (ex = PL_new_term_ref ()) &&
153
- PL_unify_term (ex ,
154
- PL_FUNCTOR , FUNCTOR_error2 ,
155
- PL_FUNCTOR , FUNCTOR_resource_error1 ,
156
- PL_CHARS , resource ,
157
- PL_VARIABLE ) )
158
- return PL_raise_exception (ex );
159
-
160
- return FALSE;
161
- }
162
-
163
-
164
147
/*******************************
165
148
* ADMIN *
166
149
*******************************/
@@ -299,10 +282,11 @@ parse_environment(term_t t, p_options *info)
299
282
term_t head = PL_new_term_ref ();
300
283
term_t tmp = PL_new_term_ref ();
301
284
ecbuf * eb = & info -> envbuf ;
302
- int count = 0 , c = 0 ;
285
+ int count = 0 ;
303
286
#ifndef __WINDOWS__
304
287
echar * q ;
305
288
char * * ep ;
289
+ int c = 0 ;
306
290
#endif
307
291
308
292
assert (eb -> size == 0 );
@@ -732,7 +716,7 @@ win_command_line(term_t t, int arity, const wchar_t *exe, wchar_t **cline)
732
716
cmdlen = av [0 ].len + (av [0 ].quote ?2 :0 )+ 1 ;
733
717
734
718
for ( i = 1 ; i <=arity ; i ++ )
735
- { PL_get_arg (i , t , arg );
719
+ { _PL_get_arg (i , t , arg );
736
720
737
721
if ( !PL_get_wchars (arg , & av [i ].len , & av [i ].text ,
738
722
CVT_ATOMIC |CVT_EXCEPTION |BUF_MALLOC ) )
@@ -834,9 +818,8 @@ find_process_from_pid(DWORD pid, const char *pred)
834
818
if ( pred )
835
819
{ term_t ex = PL_new_term_ref ();
836
820
837
- PL_put_integer (ex , pid );
838
- pl_error (NULL , 2 , NULL , ERR_EXISTENCE ,
839
- "process" , ex );
821
+ if ( PL_put_integer (ex , pid ) )
822
+ PL_existence_error ("process" , ex );
840
823
}
841
824
842
825
return (HANDLE )0 ;
@@ -937,17 +920,17 @@ win_wait_success(atom_t exe, HANDLE process)
937
920
return FALSE;
938
921
939
922
if ( rc != 0 )
940
- { term_t code = PL_new_term_ref ();
941
- term_t ex = PL_new_term_ref ();
942
-
943
- PL_unify_term ( ex ,
944
- PL_FUNCTOR , FUNCTOR_error2 ,
945
- PL_FUNCTOR , FUNCTOR_process_error2 ,
946
- PL_ATOM , exe ,
947
- PL_FUNCTOR , FUNCTOR_exit1 ,
948
- PL_LONG , rc ,
949
- PL_VARIABLE );
950
- return PL_raise_exception ( ex ) ;
923
+ { term_t ex = PL_new_term_ref ();
924
+
925
+ if ( PL_unify_term ( ex ,
926
+ PL_FUNCTOR , FUNCTOR_error2 ,
927
+ PL_FUNCTOR , FUNCTOR_process_error2 ,
928
+ PL_ATOM , exe ,
929
+ PL_FUNCTOR , FUNCTOR_exit1 ,
930
+ PL_LONG , rc ,
931
+ PL_VARIABLE ) )
932
+ return PL_raise_exception ( ex );
933
+ return FALSE ;
951
934
}
952
935
953
936
return TRUE;
@@ -1179,7 +1162,7 @@ create_pipes(p_options *info)
1179
1162
} else
1180
1163
{ if ( pipe (s -> fd ) )
1181
1164
{ assert (errno = EMFILE );
1182
- return resource_error ("open_files" );
1165
+ return PL_resource_error ("open_files" );
1183
1166
}
1184
1167
}
1185
1168
}
@@ -1595,7 +1578,6 @@ install_process()
1595
1578
MKFUNCTOR (domain_error , 2 );
1596
1579
MKFUNCTOR (process_error , 2 );
1597
1580
MKFUNCTOR (system_error , 2 );
1598
- MKFUNCTOR (resource_error , 1 );
1599
1581
MKFUNCTOR (exit , 1 );
1600
1582
MKFUNCTOR (killed , 1 );
1601
1583
0 commit comments