Skip to content

Replaces ConcNameAndVersion and ConcDirAndName macros with functions #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion inc/dirdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ typedef struct dfinfo {
} DFINFO;

#ifdef DOS
int make_old_version(char *old, char *file);
int make_old_version(char *old, size_t oldsize, char *file);
#endif
#ifdef FSDEBUG
void print_finfo(FINFO *fp);
Expand Down
6 changes: 4 additions & 2 deletions inc/dskdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ LispPTR COM_writepage(LispPTR *args);
LispPTR COM_truncatefile(LispPTR *args);
LispPTR COM_changedir(LispPTR *args);
LispPTR COM_getfreeblock(LispPTR *args);
void separate_version(char *name, char *ver, int checkp);
void conc_dir_and_name(char *dir, char *name, char *fname, size_t fname_size);
void conc_name_and_version(char *name, char *ver, char *rname, size_t rname_size);
void separate_version(char *name, size_t namesize, char *ver, size_t versize, int checkp);
int unpack_filename(char *file, char *dir, char *name, char *ver, int checkp);
int true_name(char *path);
int true_name(char *path, size_t pathsize);
#endif
84 changes: 0 additions & 84 deletions inc/locfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,90 +410,6 @@ do { \
} \
} while (0)

/*
* Name: ConcDirAndName
*
* Argument: char *dir The name of the directory.
* char *name The name of a file.
* char *fname The place where the full file name should be
* stored.
* Value: N/A
*
* Side Effect: fname is replaced with the full file name.
*
* Description:
*
* Concatenate the directory name and root file name. Checks if dir contains
* the trail directory delimiter or not.
*
*/

#define ConcDirAndName(dir, name, fname) do { \
\
char *lf_cp1, *lf_cp2; \
\
lf_cp1 = dir; \
lf_cp2 = dir; \
\
while (*lf_cp2 != '\0') { \
switch (*lf_cp2) { \
\
case '/': \
lf_cp1 = lf_cp2; \
lf_cp2++; \
break; \
\
default: \
lf_cp2++; \
break; \
} \
} \
if (lf_cp1 == (lf_cp2 - 1)) { \
if (lf_cp1 == (dir)) { \
/* dir is a root directory. */ \
strcpy(fname, "/"); \
strcat(fname, name); \
} else { \
/* The trail directory is included. */ \
strcpy(fname, dir); \
strcat(fname, name); \
} \
} else { \
/* The trail directory is not included */ \
strcpy(fname, dir); \
strcat(fname, "/"); \
strcat(fname, name); \
} \
} while (0)

/*
* Name: ConcNameAndVersion
*
* Argument: char *name The root file name.
* char *ver The file version.
* char *rname The place where the concatenated file name will be
* stored.
* Value: N/A
*
* Side Effect: rname is replaced with the concatenated file name.
*
* Description:
*
* Concatenate the root file name and its version in UNIX format.
*
*/

#define ConcNameAndVersion(name, ver, rname) do { \
if (*(ver) != '\0') { \
strcpy(rname, name); \
strcat(rname, ".~"); \
strcat(rname, ver); \
strcat(rname, "~"); \
} else { \
strcpy(rname, name); \
} \
} while (0)

#define VERSIONLEN 16

#define MAXVERSION 999999999
Expand Down
5 changes: 2 additions & 3 deletions inc/timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ extern unsigned int TIMEOUT_TIME;
} while (0)

#define S_TOUT(exp) \
alarm(TIMEOUT_TIME), \
(exp), \
alarm(0)
alarm(TIMEOUT_TIME), \
(exp)

#define ERRSETJMP(rval) \
do { \
Expand Down
9 changes: 3 additions & 6 deletions inc/ufsdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ LispPTR UFS_deletefile(LispPTR *args);
LispPTR UFS_renamefile(LispPTR *args);
LispPTR UFS_directorynamep(LispPTR *args);
#ifdef DOS
int unixpathname(char *src, char *dst, int versionp, int genp, char *drive, int *extlenptr, char *rawname);
int unixpathname(char *src, char *dst, int dstlen, int versionp, int genp, char *drive, int *extlenptr, char *rawname);
#else
int unixpathname(char *src, char *dst, int versionp, int genp);
int unixpathname(char *src, char *dst, size_t dstlen, int versionp, int genp);
#endif
int lisppathname(char *fullname, char *lispname, int dirp, int versionp);
int quote_fname(char *file);
int quote_fname_ufs(char *file);
int quote_dname(char *dir);
int lisppathname(char *fullname, char *lispname, size_t lispnamesize, int dirp, int versionp);
#ifdef DOS
init_host_filesystem(void);
exit_host_filesystem(void);
Expand Down
Loading