diff options
| author | 2023-11-15 00:45:53 +0100 | |
|---|---|---|
| committer | 2023-11-15 00:45:53 +0100 | |
| commit | acecac3cb8b66fddd9dc811c920c6b7dfb969895 (patch) | |
| tree | 7cf83250bdf17ea293187460a6d7524edfacef7e /src/common.c | |
| parent | 83600e92240cd2538cd82f90ed03601731b1b0d9 (diff) | |
| download | idevicerestore-acecac3cb8b66fddd9dc811c920c6b7dfb969895.tar.gz idevicerestore-acecac3cb8b66fddd9dc811c920c6b7dfb969895.tar.bz2 | |
Change path_get_basename()'s return type to const char*
This makes it clear that the return value is immutable and moreover suggests
that the return vale is not allocated and thus should be treated carefully.
Diffstat (limited to 'src/common.c')
| -rw-r--r-- | src/common.c | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/src/common.c b/src/common.c index bb534e2..c3c9d68 100644 --- a/src/common.c +++ b/src/common.c @@ -696,10 +696,10 @@ int _plist_dict_copy_item(plist_t target_dict, plist_t source_dict, const char *  	return 0;  } -char* path_get_basename(char* path) +const char* path_get_basename(char* path)  {  #ifdef WIN32 -	char *p = path + strlen(path); +	const char *p = path + strlen(path);  	while (p > path) {  		if ((*p == '/') || (*p == '\\')) {  			return p+1; @@ -708,7 +708,7 @@ char* path_get_basename(char* path)  	}  	return p;  #else -	char *p = strrchr(path, '/'); +	const char *p = strrchr(path, '/');  	return p ? p + 1 : path;  #endif  } | 
