(Apple) Move some C common code from ObjC file to platform_apple.c