Write URL.sanitize_url in C.