On 01.12.22 09:55, Bharath Rupireddy wrote:
can we have a generic,
single function file_exists() in fd.c/file_utils.c so that both
backend and frontend code can use it? I see there are 3 uses and
definitions of it in jit.c, dfmgr.c and pg_regress.c. This will reduce
the code duplication. Thoughts?

Well, the first problem with that would be that all three of those implementations are slightly different. Maybe that is intentional, or maybe not, in which case a common implementation might be beneficial.

(Another thing to consider is that checking whether a file exists is not often actually useful. If you want to use the file, you should just open it and then check for any errors. The cases above have special requirements, so there obviously are uses, but I'm not sure how many in the long run.)



Reply via email to