Mercurial > hg > octave-nkf > gnulib-hg
changeset 17919:c3b0e9dd56c5
tempname: allow compilation with C++ (trivial)
* lib/tempname.h [C++]: Specify extern "C" linkage.
* lib/tempname.h (try_tempname):
* lib/tempname.c (__try_tempname, __gen_tempname):
Rename 'try' to 'tryfunc'.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Tue, 17 Feb 2015 22:04:51 -0800 |
parents | a1f80b7d1920 |
children | 7a288a43abf9 |
files | ChangeLog lib/tempname.c lib/tempname.h |
diffstat | 3 files changed, 26 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-02-17 Mike Miller <mtmiller@ieee.org> + + tempname: allow compilation with C++ (trivial) + * lib/tempname.h [C++]: Specify extern "C" linkage. + * lib/tempname.h (try_tempname): + * lib/tempname.c (__try_tempname, __gen_tempname): + Rename 'try' to 'tryfunc'. + 2015-02-17 Paul Eggert <eggert@cs.ucla.edu> dup2, fcntl: port to AIX
--- a/lib/tempname.c +++ b/lib/tempname.c @@ -179,7 +179,7 @@ int __try_tempname (char *tmpl, int suffixlen, void *args, - int (*try) (char *, void *)) + int (*tryfunc) (char *, void *)) { int len; char *XXXXXX; @@ -244,7 +244,7 @@ v /= 62; XXXXXX[5] = letters[v % 62]; - fd = try (tmpl, args); + fd = tryfunc (tmpl, args); if (fd >= 0) { __set_errno (save_errno); @@ -300,25 +300,25 @@ int __gen_tempname (char *tmpl, int suffixlen, int flags, int kind) { - int (*try) (char *, void *); + int (*tryfunc) (char *, void *); switch (kind) { case __GT_FILE: - try = try_file; + tryfunc = try_file; break; case __GT_DIR: - try = try_dir; + tryfunc = try_dir; break; case __GT_NOCREATE: - try = try_nocreate; + tryfunc = try_nocreate; break; default: assert (! "invalid KIND in __gen_tempname"); abort (); } - return __try_tempname (tmpl, suffixlen, &flags, try); + return __try_tempname (tmpl, suffixlen, &flags, tryfunc); }
--- a/lib/tempname.h +++ b/lib/tempname.h @@ -32,6 +32,10 @@ # define GT_NOCREATE 2 # endif +#ifdef __cplusplus +extern "C" { +#endif + /* Generate a temporary file name based on TMPL. TMPL must match the rules for mk[s]temp (i.e. end in "XXXXXX", possibly with a suffix). The name constructed does not exist at the time of the call to @@ -47,11 +51,15 @@ We use a clever algorithm to get hard-to-predict names. */ extern int gen_tempname (char *tmpl, int suffixlen, int flags, int kind); -/* Similar to gen_tempname, but TRY is called for each temporary - name to try. If TRY returns a non-negative number, TRY_GEN_TEMPNAME +/* Similar to gen_tempname, but TRYFUNC is called for each temporary + name to try. If TRYFUNC returns a non-negative number, TRY_GEN_TEMPNAME returns with this value. Otherwise, if errno is set to EEXIST, another name is tried, or else TRY_GEN_TEMPNAME returns -1. */ extern int try_tempname (char *tmpl, int suffixlen, void *args, - int (*try) (char *, void *)); + int (*tryfunc) (char *, void *)); + +#ifdef __cplusplus +} +#endif #endif /* GL_TEMPNAME_H */