move some common functions to common.cpp and add some functions in common
Merge pull request #574 from ruil2/vp_update

    move some common functions to common.cpp and add some functions in c...