about summary refs log tree commit diff
path: root/Src/hashtable.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2017-01-28 19:33:27 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2017-01-28 19:33:27 +0000
commit34f70c5dc08bbecd20fbb8a1797851103fbad45e (patch)
tree5170a04f299804c871a9c6ba913d5d07bfa576b2 /Src/hashtable.c
parentea7b4d4b2da60fe44019b1c0e298a202a3b211b7 (diff)
downloadzsh-34f70c5dc08bbecd20fbb8a1797851103fbad45e.tar.gz
zsh-34f70c5dc08bbecd20fbb8a1797851103fbad45e.tar.xz
zsh-34f70c5dc08bbecd20fbb8a1797851103fbad45e.zip
40440: Add $functions_source hash to zsh/parameter.
This allows you to find out where a function was loaded from.
Diffstat (limited to 'Src/hashtable.c')
-rw-r--r--Src/hashtable.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Src/hashtable.c b/Src/hashtable.c
index 1f2789d07..8987c8597 100644
--- a/Src/hashtable.c
+++ b/Src/hashtable.c
@@ -1566,6 +1566,15 @@ dircache_set(char **name, char *value)
 	*name = NULL;
     } else {
 	/*
+	 * As the function path has been resolved to a particular
+	 * location, we'll store it as an absolute path.
+	 */
+	if (*value != '/') {
+	    value = zhtricat(metafy(zgetcwd(), -1, META_HEAPDUP),
+			     "/", value);
+	    value = xsymlink(value, 1);
+	}
+	/*
 	 * We'll maintain the cache at exactly the right size rather
 	 * than overallocating.  The rationale here is that typically
 	 * we'll get a lot of functions in a small number of directories