if (dirMatch) {
dirMapping[dirNum] = dirMatch - al->dirs;
} else {
- al->dirs[al->numDirs].dirName = strdup(dirList[dirNum]);
+ al->dirs[al->numDirs].dirName = xstrdup(dirList[dirNum]);
al->dirs[al->numDirs].files = NULL;
al->dirs[al->numDirs].numFiles = 0;
al->dirs[al->numDirs].dirNum = al->numDirs;
static struct availablePackage * alFileSatisfiesDepend(
struct availableList * al, const char * keyType, const char *fileName) {
int i;
- char * file = strdup(fileName);
+ char * file = xstrdup(fileName);
char * chptr = strrchr(file, '/');
char * base;
struct dirInfo dirNeedle;
fas.fileSize = faLseek(&fas, 0, SEEK_CUR);
}
- /* XXX xmalloc is inappopriate here */
if ((fa = malloc(sizeof(*fa))) != NULL) {
fa->fd = fas.fd;
fa->readOnly = fas.readOnly;
if (!overwrite && getenv(name)) return 0;
i = strlen(name) + strlen(value) + 2;
- a = malloc(i);
+ a = xmalloc(i);
if (!a) return 1;
strcpy(a, name);
}
/* this is pretty straight-forward. The only thing that even resembles a trick
- is getting all of this into a single malloc'd block */
+ is getting all of this into a single xmalloc'd block */
void buildFileList(Header h, char *** fileListPtr, int * fileCountPtr) {
int * dirList;
char ** dirs;
size += strlen(tails[i]) + strlen(dirs[dirList[i]]) + 1;
}
- fileList = malloc(size);
+ fileList = xmalloc(size);
data = ((char *) fileList) + (sizeof(*fileList) * count);
for (i = 0; i < count; i++) {
} else {
char * filespec;
- filespec = malloc(strlen(dirList[dirIndexList[i]])
+ filespec = xmalloc(strlen(dirList[dirIndexList[i]])
+ strlen(baseNameList[i]) + 1);
strcpy(filespec, dirList[dirIndexList[i]]);
strcat(filespec, baseNameList[i]);
do {
num = allMatches.recs[i].fileNumber;
- otherFile = malloc(strlen(dirNames[dirIndexes[num]]) +
+ otherFile = xmalloc(strlen(dirNames[dirIndexes[num]]) +
strlen(baseNames[num]) + 1);
strcpy(otherFile, dirNames[dirIndexes[num]]);
strcat(otherFile, baseNames[num]);
urlinfo *newUrlinfo(void)
{
urlinfo *u;
- if ((u = malloc(sizeof(*u))) == NULL)
+ if ((u = xmalloc(sizeof(*u))) == NULL)
return NULL;
memset(u, 0, sizeof(*u));
u->proxyp = -1;