GPL Question

No. If you wrote the function for B, you own the copyright, so you can do whatever you want with it (although obviously it’s good to GPL it…)