This commit is contained in:
John Kerl 2015-07-27 09:53:42 -04:00
parent 38bded025a
commit 418dc485c4
3 changed files with 8 additions and 7 deletions

View file

@ -110,8 +110,7 @@ mv_t lrec_evaluator_f_f_func(lrec_t* prec, context_t* pctx, void* pvstate) {
NULL_OR_ERROR_OUT(val1);
mt_get_double_nullable(&val1);
if (val1.type == MT_NULL)
return val1;
NULL_OUT(val1);
if (val1.type != MT_DOUBLE)
return MV_ERROR;
@ -142,16 +141,14 @@ mv_t lrec_evaluator_f_ff_func(lrec_t* prec, context_t* pctx, void* pvstate) {
mv_t val1 = pstate->parg1->pevaluator_func(prec, pctx, pstate->parg1->pvstate);
NULL_OR_ERROR_OUT(val1);
mt_get_double_nullable(&val1);
if (val1.type == MT_NULL)
return val1;
NULL_OUT(val1);
if (val1.type != MT_DOUBLE)
return MV_ERROR;
mv_t val2 = pstate->parg2->pevaluator_func(prec, pctx, pstate->parg2->pvstate);
NULL_OR_ERROR_OUT(val2);
mt_get_double_nullable(&val2);
if (val2.type == MT_NULL)
return val2;
NULL_OUT(val2);
if (val2.type != MT_DOUBLE)
return MV_ERROR;

View file

@ -44,6 +44,10 @@ extern mv_t MV_ERROR;
return MV_NULL; \
}
#define NULL_OUT(val) { \
if ((val).type == MT_NULL) \
return MV_NULL; \
}
#define ERROR_OUT(val) { \
if ((val).type == MT_ERROR) \
return MV_ERROR; \

View file

@ -7,7 +7,7 @@ TOP OF LIST
* make a -D for hash-collision stats ...
* go through remaining functions to decide when null-through is ok.
* also document thoroughly.
* also document thoroughly. emphasize this is crucial for heterogeneous data.
* doc w/ very specific examples of sed/grep/etc preprocessing to structurize semi-structured data (e.g. logs)