fix empty lists
This commit is contained in:
parent
adea3bdb24
commit
a654907fe1
9
C/text.c
9
C/text.c
@ -144,6 +144,13 @@ SkipListCodes(Term *l, Term **tailp, Int *atoms, int *wide)
|
|||||||
do_derefa(v,l,derefa_unk,derefa_nonvar);
|
do_derefa(v,l,derefa_unk,derefa_nonvar);
|
||||||
s = l;
|
s = l;
|
||||||
|
|
||||||
|
|
||||||
|
if (*l == TermNil) {
|
||||||
|
*tailp = l;
|
||||||
|
*atoms = 0;
|
||||||
|
*wide = FALSE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if ( IsPairTerm(*l) )
|
if ( IsPairTerm(*l) )
|
||||||
{ intptr_t power = 1, lam = 0;
|
{ intptr_t power = 1, lam = 0;
|
||||||
do
|
do
|
||||||
@ -468,7 +475,7 @@ read_Text( void *buf, seq_tv_t *inp, encoding_t *enc, int *minimal USES_REGS)
|
|||||||
LOCAL_Error_TYPE = gen_type_error( inp->type );
|
LOCAL_Error_TYPE = gen_type_error( inp->type );
|
||||||
LOCAL_Error_Term = t;
|
LOCAL_Error_Term = t;
|
||||||
}
|
}
|
||||||
} else if (IsPairTerm(t)) {
|
} else if (IsPairTerm(t) || t == TermNil) {
|
||||||
if (inp->type & (YAP_STRING_CODES|YAP_STRING_ATOMS)) {
|
if (inp->type & (YAP_STRING_CODES|YAP_STRING_ATOMS)) {
|
||||||
inp->type &= (YAP_STRING_CODES|YAP_STRING_ATOMS);
|
inp->type &= (YAP_STRING_CODES|YAP_STRING_ATOMS);
|
||||||
return read_Text( buf, inp, enc, minimal PASS_REGS);
|
return read_Text( buf, inp, enc, minimal PASS_REGS);
|
||||||
|
Reference in New Issue
Block a user