char const * fname,
char const * mode )
{
- return estrdup(fname);
+ return strdup(fname);
}
#else
int result_len;
if (!dot_path || *string == '/') {
- result = estrdup( string );
+ result = strdup( string );
+ if (result == NULL) {
+ return NULL; /* couldn't allocate memory */
+ }
} else {
if (dot_path && dot_path[0]) {
- result = emalloc( 2 + strlen( dot_path ) + strlen( string ) );
+ result = malloc( 2 + strlen( dot_path ) + strlen( string ) );
+ if (result == NULL) {
+ return NULL; /* couldn't allocate memory */
+ }
strcpy( result, dot_path );
result_len = (int)strlen(result);
if (result[result_len - 1] != '/') {
result[result_len] = '\0';
}
} else {
- result = emalloc( 3 + strlen( string ) );
+ result = malloc( 3 + strlen( string ) );
+ if (result == NULL) {
+ return NULL; /* couldn't allocate memory */
+ }
result[0] = '.'; result[1] = '/'; result[2] = '\0';
result_len = 2;
}
char stub_char, *result;
/* The result cannot be larger than the input PATH. */
- result = estrdup( path );
-
+ result = strdup( path );
+ if (result == NULL) {
+ return NULL; /* couldn't allocate memory */
+ }
stub_char = (*path == '/') ? '/' : '.';
/* Walk along RESULT looking for things to compact. */