More common subroutines

git-svn-id: svn://svn.cc65.org/cc65/trunk@69 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2000-06-14 09:32:22 +00:00
parent 114bc5a370
commit 1081c1dcdd
27 changed files with 363 additions and 151 deletions

View File

@@ -44,7 +44,8 @@
# include <unistd.h>
#endif
#include "mem.h"
#include "../common/xmalloc.h"
#include "incpath.h"
@@ -83,7 +84,7 @@ static char* Add (char* Orig, const char* New)
}
/* Allocate memory for the new string */
NewPath = Xmalloc (OrigLen + NewLen + 2);
NewPath = xmalloc (OrigLen + NewLen + 2);
/* Copy the strings */
memcpy (NewPath, Orig, OrigLen);
@@ -92,7 +93,7 @@ static char* Add (char* Orig, const char* New)
NewPath [OrigLen+NewLen+1] = '\0';
/* Delete the original path */
Xfree (Orig);
xfree (Orig);
/* Return the new path */
return NewPath;
@@ -138,8 +139,8 @@ static char* Find (const char* Path, const char* File)
/* Check if this file exists */
if (access (PathName, R_OK) == 0) {
/* The file exists */
return StrDup (PathName);
}
return xstrdup (PathName);
}
/* Skip a list separator if we have one */
if (*P == ';') {