-
Paul Eggert authored
Also, close some minor races when opening image files, by opening them once instead of multiple times. * src/gtkutil.c (xg_get_image_for_pixmap): * src/image.c (xpm_load, tiff_load, gif_load, imagemagick_load) (svg_load): * src/nsimage.m (allocInitFromFile:): * src/xfns.c (xg_set_icon): Encode file name, since x_find_image_file no longer does that. * src/image.c (x_find_image_fd): New function. (x_find_image_file): Use it. Do not encode resulting file name, since callers sometimes need it decoded. (slurp_file): File arg is now a fd, not a file name. All callers changed. This saves us having to open the file twice. (xbm_load, xpm_load, pbm_load, png_load_body, jpeg_load_body) (svg_load): Use x_find_image_fd and fdopen to save a file-open. Report file name that failed. * src/lread.c (openp): If PREDICATE is t, open the file in binary mode.
63673686