Switch to Num_Mimic in C version of Inverter Simplifies the code and removes calls to Obj_To_[FI]64.
As a side effect, the C bindings don't accept Strings in a document's Num field anymore. Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/c0ab70d3 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/c0ab70d3 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/c0ab70d3 Branch: refs/heads/master Commit: c0ab70d3eef4932987c3bcffe0f115effb8659f0 Parents: dbcce56 Author: Nick Wellnhofer <[email protected]> Authored: Sat May 23 16:57:37 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Sat May 23 17:09:12 2015 +0200 ---------------------------------------------------------------------- c/src/Lucy/Index/Inverter.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/c0ab70d3/c/src/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c index 23622d8..efcaa58 100644 --- a/c/src/Lucy/Index/Inverter.c +++ b/c/src/Lucy/Index/Inverter.c @@ -92,27 +92,23 @@ Inverter_Invert_Doc_IMP(Inverter *self, Doc *doc) { break; } case FType_INT32: { - int32_t int_val = (int32_t)Obj_To_I64(obj); Integer32* value = (Integer32*)inventry_ivars->value; - Int32_Set_Value(value, int_val); + Int32_Mimic(value, obj); break; } case FType_INT64: { - int64_t int_val = Obj_To_I64(obj); Integer64* value = (Integer64*)inventry_ivars->value; - Int64_Set_Value(value, int_val); + Int64_Mimic(value, obj); break; } case FType_FLOAT32: { - float float_val = (float)Obj_To_F64(obj); Float32* value = (Float32*)inventry_ivars->value; - Float32_Set_Value(value, float_val); + Float32_Mimic(value, obj); break; } case FType_FLOAT64: { - double float_val = Obj_To_F64(obj); Float64* value = (Float64*)inventry_ivars->value; - Float64_Set_Value(value, float_val); + Float64_Mimic(value, obj); break; } default:
