summaryrefslogtreecommitdiff
path: root/lib/relocatable.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2008-01-10 11:12:06 +0100
committerBruno Haible <bruno@clisp.org>2008-01-10 11:12:06 +0100
commit619c189e199adf139ed298d1852e92987eb6289f (patch)
treeb54f8cbdecaa3de535f109ce37fd2dcaebab11ca /lib/relocatable.h
parent7ba813f0fe78d2c88b6efbf3e82e7a58112b2e1a (diff)
downloadgnulib-619c189e199adf139ed298d1852e92987eb6289f.tar.gz
Make it possible to avoid all memory leaks when calling relocate().
Diffstat (limited to 'lib/relocatable.h')
-rw-r--r--lib/relocatable.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/relocatable.h b/lib/relocatable.h
index 5970be7a27..8f1e2aa1b6 100644
--- a/lib/relocatable.h
+++ b/lib/relocatable.h
@@ -49,12 +49,15 @@ extern RELOCATABLE_DLL_EXPORTED void
const char *curr_prefix);
/* Returns the pathname, relocated according to the current installation
- directory. */
+ directory.
+ The returned string is either PATHNAME unmodified or a freshly allocated
+ string that you can free with free() after casting it to 'char *'. */
extern const char * relocate (const char *pathname);
/* Memory management: relocate() leaks memory, because it has to construct
a fresh pathname. If this is a problem because your program calls
- relocate() frequently, think about caching the result. */
+ relocate() frequently, think about caching the result. Or free the
+ return value if it was different from the argument pathname. */
/* Convenience function:
Computes the current installation prefix, based on the original