From d07736843617b7faed6adc1799b70b9d3a7d6497 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Sat, 12 Oct 2024 08:36:54 +0100 Subject: [PATCH] path.c: PaLockOpen() constify and add prototype --- utils/path.c | 13 +++++++------ utils/utils.h | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/utils/path.c b/utils/path.c index bb948ade..acd3fc5a 100644 --- a/utils/path.c +++ b/utils/path.c @@ -632,18 +632,18 @@ PaLockZOpen(file, mode, ext, path, library, pRealName, is_locked, fdp) FILE * PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp) - char *file; /* Name of the file to be opened. */ - char *mode; /* The file mode, as given to fopen. */ - char *ext; /* The extension to be added to the file name, + const char *file; /* Name of the file to be opened. */ + const char *mode; /* The file mode, as given to fopen. */ + const char *ext; /* The extension to be added to the file name, * or NULL. Note: this string must include * the dot (or whatever separator you use). */ - char *path; /* A search path: a list of directory names + const char *path; /* A search path: a list of directory names * separated by colons or blanks. To use * only the working directory, use "." for * the path. */ - char *library; /* A 2nd path containing library names. Can be + const char *library; /* A 2nd path containing library names. Can be * NULL to indicate no library. */ char **pRealName; /* Pointer to a location that will be filled @@ -658,7 +658,8 @@ PaLockOpen(file, mode, ext, path, library, pRealName, is_locked, fdp) */ int *fdp; /* If non-NULL, put the file descriptor here. */ { - char extendedName[MAXSIZE], *p1, *p2; + char extendedName[MAXSIZE], *p1; + const char *p2; static char realName[MAXSIZE]; int length, extLength, i; FILE *f; diff --git a/utils/utils.h b/utils/utils.h index 33b35836..3b94e287 100644 --- a/utils/utils.h +++ b/utils/utils.h @@ -49,7 +49,8 @@ extern int LookupStructFull(const char *str, const char * const *table, int size extern int PaExpand(const char **, char **, int); extern char *nextName(const char **ppath, const char *file, char *dest, int size); extern FILE *PaOpen(char *, char *, char *, char *, char *, char **); -extern FILE *PaLockOpen(char *, char *, char *, char *, char *, char **, bool *, int *); +extern FILE *PaLockOpen(const char *file, const char *mode, const char *ext, const char *path, const char *library, + char **pRealName, bool *is_locked, int *fdp); extern char *StrDup(char **, const char *); extern bool Match(const char *pattern, const char *string); extern char *ArgStr(int *pargc, char ***pargv, const char *argType);