GLib version 1 is very outdated by now and not available in any recent Linux distribution. Keeping this code around without actually being able to test it makes little sense so let's get rid of that.
Replace sprintf() calls with snprintf() for security reasons.