Skip to content
Snippets Groups Projects
Commit 239bc737 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'use-strdup'


5d2aff9d ProcessWin32: use strdup() instead of open coding it
cf8beae3 ProcessUNIX: use strdup() instead of open coding it

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !56
parents efda2a7a 5d2aff9d
No related branches found
No related tags found
No related merge requests found
......@@ -496,11 +496,10 @@ int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
cp->WorkingDirectory = 0;
}
if (dir) {
cp->WorkingDirectory = (char*)malloc(strlen(dir) + 1);
cp->WorkingDirectory = strdup(dir);
if (!cp->WorkingDirectory) {
return 0;
}
strcpy(cp->WorkingDirectory, dir);
}
return 1;
}
......@@ -529,11 +528,10 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
*pfile = 0;
}
if (file) {
*pfile = (char*)malloc(strlen(file) + 1);
*pfile = strdup(file);
if (!*pfile) {
return 0;
}
strcpy(*pfile, file);
}
/* If we are redirecting the pipe, do not share it or use a native
......
......@@ -711,11 +711,10 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, const char* file)
*pfile = 0;
}
if (file) {
*pfile = (char*)malloc(strlen(file) + 1);
*pfile = strdup(file);
if (!*pfile) {
return 0;
}
strcpy(*pfile, file);
}
/* If we are redirecting the pipe, do not share it or use a native
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment