Rewrite register profile parser to make it cleaner and more robust

As a side effect it calculates the size of the register profile on the fly, beside looking cleaner and easier to expand.
I have tested it with a couple of well and ill formed profiles and showed no problem.
We can also stop strdup'ing the register profiles now, yay.
Please comment/review