ruby-changes:29650
From: nobu <ko1@a...>
Date: Sun, 30 Jun 2013 10:59:01 +0900 (JST)
Subject: [ruby-changes:29650] nobu:r41702 (trunk): dln.c: extra arguments
nobu 2013-06-30 10:58:51 +0900 (Sun, 30 Jun 2013) New Revision: 41702 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41702 Log: dln.c: extra arguments * dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra arguments to dln_find_{exe,file}_r(). * dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments. Modified files: trunk/ChangeLog trunk/dln.h trunk/dln_find.c Index: dln_find.c =================================================================== --- dln_find.c (revision 41701) +++ dln_find.c (revision 41702) @@ -63,10 +63,12 @@ char *dln_argv0; https://github.com/ruby/ruby/blob/trunk/dln_find.c#L63 char *getenv(); #endif -static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag); +static char *dln_find_1(const char *fname, const char *path, char *buf, size_t size, int exe_flag + DLN_FIND_EXTRA_ARG_DECL); char * -dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size) +dln_find_exe_r(const char *fname, const char *path, char *buf, size_t size + DLN_FIND_EXTRA_ARG_DECL) { char *envpath = 0; @@ -82,21 +84,23 @@ dln_find_exe_r(const char *fname, const https://github.com/ruby/ruby/blob/trunk/dln_find.c#L84 path = "/usr/local/bin:/usr/ucb:/usr/bin:/bin:."; #endif } - buf = dln_find_1(fname, path, buf, size, 1); + buf = dln_find_1(fname, path, buf, size, 1 DLN_FIND_EXTRA_ARG); if (envpath) free(envpath); return buf; } char * -dln_find_file_r(const char *fname, const char *path, char *buf, size_t size) +dln_find_file_r(const char *fname, const char *path, char *buf, size_t size + DLN_FIND_EXTRA_ARG_DECL) { if (!path) path = "."; - return dln_find_1(fname, path, buf, size, 0); + return dln_find_1(fname, path, buf, size, 0 DLN_FIND_EXTRA_ARG); } static char * dln_find_1(const char *fname, const char *path, char *fbuf, size_t size, - int exe_flag /* non 0 if looking for executable. */) + int exe_flag /* non 0 if looking for executable. */ + DLN_FIND_EXTRA_ARG_DECL) { register const char *dp; register const char *ep; Index: ChangeLog =================================================================== --- ChangeLog (revision 41701) +++ ChangeLog (revision 41702) @@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Sun Jun 30 10:57:13 2013 Nobuyoshi Nakada <nobu@r...> +Sun Jun 30 10:58:47 2013 Nobuyoshi Nakada <nobu@r...> + + * dln.h (DLN_FIND_EXTRA_ARG, DLN_FIND_EXTRA_ARG_DECL): allow extra + arguments to dln_find_{exe,file}_r(). + + * dln_find.c (dln_find_exe_r, dln_find_file_r): add extract arguments. * process.c (EXPORT_STR, EXPORT_DUP): convert to default process encoding if defined. Index: dln.h =================================================================== --- dln.h (revision 41701) +++ dln.h (revision 41702) @@ -30,8 +30,15 @@ https://github.com/ruby/ruby/blob/trunk/dln.h#L30 RUBY_SYMBOL_EXPORT_BEGIN -char *dln_find_exe_r(const char*,const char*,char*,size_t); -char *dln_find_file_r(const char*,const char*,char*,size_t); +#ifndef DLN_FIND_EXTRA_ARG +#define DLN_FIND_EXTRA_ARG +#endif +#ifndef DLN_FIND_EXTRA_ARG_DECL +#define DLN_FIND_EXTRA_ARG_DECL +#endif + +char *dln_find_exe_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL); +char *dln_find_file_r(const char*,const char*,char*,size_t DLN_FIND_EXTRA_ARG_DECL); #ifdef USE_DLN_A_OUT extern char *dln_argv0; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/