reorder functions in ldb.cc, make local functions static