char* types in FFI calls can no longer accept null pointers
parent
e5abd93601
commit
f5450b045b
4
vm/io.c
4
vm/io.c
|
@ -35,8 +35,8 @@ void primitive_fopen(void)
|
|||
char *path, *mode;
|
||||
FILE* file;
|
||||
maybe_gc(0);
|
||||
mode = pop_char_string();
|
||||
path = pop_char_string();
|
||||
mode = unbox_char_string();
|
||||
path = unbox_char_string();
|
||||
file = fopen(path,mode);
|
||||
if(file == NULL)
|
||||
io_error();
|
||||
|
|
|
@ -131,7 +131,7 @@ void primitive_cwd(void)
|
|||
void primitive_cd(void)
|
||||
{
|
||||
maybe_gc(0);
|
||||
chdir(pop_char_string());
|
||||
chdir(unbox_char_string());
|
||||
}
|
||||
|
||||
BOUNDED_BLOCK *alloc_bounded_block(CELL size)
|
||||
|
|
|
@ -163,7 +163,7 @@ void primitive_cwd(void)
|
|||
void primitive_cd(void)
|
||||
{
|
||||
maybe_gc(0);
|
||||
SetCurrentDirectory(pop_char_string());
|
||||
SetCurrentDirectory(unbox_char_string());
|
||||
}
|
||||
|
||||
BOUNDED_BLOCK *alloc_bounded_block(CELL size)
|
||||
|
|
2
vm/run.c
2
vm/run.c
|
@ -170,7 +170,7 @@ void primitive_os_env(void)
|
|||
|
||||
maybe_gc(0);
|
||||
|
||||
name = pop_char_string();
|
||||
name = unbox_char_string();
|
||||
value = getenv(name);
|
||||
if(value == NULL)
|
||||
dpush(F);
|
||||
|
|
|
@ -356,16 +356,9 @@ F_ARRAY *allot_c_string(CELL capacity, CELL size)
|
|||
else \
|
||||
return (type*)(string_to_##type##_alien(s,check) + 1); \
|
||||
} \
|
||||
type *pop_##type##_string(void) \
|
||||
{ \
|
||||
return to_##type##_string(untag_string(dpop()),true); \
|
||||
} \
|
||||
type *unbox_##type##_string(void) \
|
||||
{ \
|
||||
if(type_of(dpeek()) == STRING_TYPE) \
|
||||
return pop_##type##_string(); \
|
||||
else \
|
||||
return unbox_alien(); \
|
||||
return to_##type##_string(untag_string(dpop()),true); \
|
||||
} \
|
||||
void primitive_string_to_##type##_alien(void) \
|
||||
{ \
|
||||
|
|
|
@ -110,7 +110,6 @@ void char_string_to_memory(F_STRING *s, char *string);
|
|||
void primitive_char_string_to_memory(void);
|
||||
F_ARRAY *string_to_char_alien(F_STRING *s, bool check);
|
||||
char* to_char_string(F_STRING *s, bool check);
|
||||
char *pop_char_string(void);
|
||||
DLLEXPORT char *unbox_char_string(void);
|
||||
void primitive_string_to_char_alien(void);
|
||||
|
||||
|
@ -118,7 +117,6 @@ void u16_string_to_memory(F_STRING *s, u16 *string);
|
|||
void primitive_u16_string_to_memory(void);
|
||||
F_ARRAY *string_to_u16_alien(F_STRING *s, bool check);
|
||||
u16* to_u16_string(F_STRING *s, bool check);
|
||||
u16 *pop_u16_string(void);
|
||||
DLLEXPORT u16 *unbox_u16_string(void);
|
||||
void primitive_string_to_u16_alien(void);
|
||||
|
||||
|
|
Loading…
Reference in New Issue