Looking once again at the code, the function can set the value in any (pseduo-)variable, not only in AVP, right? Because it is using pv->setf() function, not the AVP specific functions.
Do you want to restrict to writing to AVP or it is fine writing to any variable?