Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Introduce new function real_path_if_valid()
author
Michael Haggerty
<mhagger@alum.mit.edu>
Sun, 28 Oct 2012 16:16:22 +0000
(17:16 +0100)
committer
Jeff King
<peff@peff.net>
Mon, 29 Oct 2012 06:34:58 +0000
(
02:34
-0400)
The function is like real_path(), except that it returns NULL on error
instead of dying.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
abspath.c
patch
|
blob
|
history
cache.h
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
d6052ab
)
diff --git
a/abspath.c
b/abspath.c
index f8a526f3916d753addac6acce1986cd3079472b8..40cdc46219d4eba87ba947d9f5556eb80dfdfa9b 100644
(file)
--- a/
abspath.c
+++ b/
abspath.c
@@
-153,6
+153,11
@@
const char *real_path(const char *path)
return real_path_internal(path, 1);
}
return real_path_internal(path, 1);
}
+const char *real_path_if_valid(const char *path)
+{
+ return real_path_internal(path, 0);
+}
+
static const char *get_pwd_cwd(void)
{
static char cwd[PATH_MAX + 1];
static const char *get_pwd_cwd(void)
{
static char cwd[PATH_MAX + 1];
diff --git
a/cache.h
b/cache.h
index a58df84bd374feda0e0c7fdfe65129db2cb3c252..b0d75bcb0e5dd9bee0280233784abf1aad4e494b 100644
(file)
--- a/
cache.h
+++ b/
cache.h
@@
-714,6
+714,7
@@
static inline int is_absolute_path(const char *path)
}
int is_directory(const char *);
const char *real_path(const char *path);
}
int is_directory(const char *);
const char *real_path(const char *path);
+const char *real_path_if_valid(const char *path);
const char *absolute_path(const char *path);
const char *relative_path(const char *abs, const char *base);
int normalize_path_copy(char *dst, const char *src);
const char *absolute_path(const char *path);
const char *relative_path(const char *abs, const char *base);
int normalize_path_copy(char *dst, const char *src);