ur: distinguish bad backreferences from other failures in cue

This commit is contained in:
Joe Bryan 2020-08-31 17:51:39 -07:00
parent 612df9541f
commit fd5edcb6b6
2 changed files with 5 additions and 9 deletions

View File

@ -5,8 +5,9 @@
typedef enum { typedef enum {
ur_cue_good = 0, ur_cue_good = 0,
ur_cue_gone = 1, ur_cue_back = 1,
ur_cue_meme = 2 ur_cue_gone = 2,
ur_cue_meme = 3
} ur_cue_res_e; } ur_cue_res_e;
typedef enum { typedef enum {

View File

@ -174,10 +174,8 @@ _cue_next(ur_root_t *r,
else { else {
uint64_t val, bak = ur_bsr64_any(bsr, len); uint64_t val, bak = ur_bsr64_any(bsr, len);
// XX distinguish bad backref?
//
if ( !ur_dict64_get(r, dict, bak, &val) ) { if ( !ur_dict64_get(r, dict, bak, &val) ) {
return ur_cue_gone; return ur_cue_back;
} }
*out = (ur_nref)val; *out = (ur_nref)val;
@ -356,12 +354,9 @@ _cue_test_next(_cue_test_stack_t *s,
} }
else { else {
uint64_t bak = ur_bsr64_any(bsr, len); uint64_t bak = ur_bsr64_any(bsr, len);
// XX distinguish bad backref?
//
return ur_dict_get((ur_root_t*)0, dict, bak) return ur_dict_get((ur_root_t*)0, dict, bak)
? ur_cue_good ? ur_cue_good
: ur_cue_gone; : ur_cue_back;
} }
} }