diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-02-04 23:30:57 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-02-04 23:30:57 -0800 |
commit | 022ea8cfd80b97221abfbf2ba09110c0ecef3dc6 (patch) | |
tree | fb73620e086bd59134b41e9bc11d401df9219f4f /sysif.c | |
parent | c554db7ce82378612673e33d905b29f2d820a1a5 (diff) | |
download | txr-022ea8cfd80b97221abfbf2ba09110c0ecef3dc6.tar.gz txr-022ea8cfd80b97221abfbf2ba09110c0ecef3dc6.tar.bz2 txr-022ea8cfd80b97221abfbf2ba09110c0ecef3dc6.zip |
fstat: turn into true alias.
We can get rid of fstat_wrap entirely and make
the lstat and fstat function bindings point to the same
function.
* parser.c (load_rcfile): Call stat_wrap instead of
fstat_wrap.
* sysif.c (stat_wrap): Static function becomes extern. Useless
forward declaration removed.
(fstat_wrap): Static function removed.
(sysif_init): Bind fstat and lstat to the same function
object.
* sysif.h (fstat_wrap): Declaration removed.
(stat_wrap): Declaration added.
Diffstat (limited to 'sysif.c')
-rw-r--r-- | sysif.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -556,8 +556,6 @@ static val mkfifo_wrap(val path, val mode) enum chm_state { chm_who, chm_perm, chm_nxtop, chm_comma }; enum chm_op { chm_add, chm_sub, chm_set }; -static val stat_wrap(val path); - static val chmod_wrap(val target, val mode) { val self = lit("chmod"); @@ -1128,7 +1126,7 @@ static val stat_impl(val obj, int (*statfn)(val, struct stat *), #endif } -static val stat_wrap(val path) +val stat_wrap(val path) { return stat_impl(path, do_stat, lit("stat"), path); } @@ -1138,11 +1136,6 @@ static val lstat_wrap(val path) return stat_impl(path, do_lstat, lit("lstat"), path); } -val fstat_wrap(val stream) -{ - return stat_impl(stream, do_stat, lit("fstat"), nil); -} - #if HAVE_FILE_STAMP_CHANGE #if HAVE_FUTIMENS @@ -2372,9 +2365,12 @@ void sysif_init(void) reg_fun(intern(lit("lutimes"), user_package), func_n5(wrap_lutimes)); #endif - reg_fun(intern(lit("stat"), user_package), func_n1(stat_wrap)); + { + val fn = func_n1(stat_wrap); + reg_fun(intern(lit("stat"), user_package), fn); + reg_fun(intern(lit("fstat"), user_package), fn); + } reg_fun(intern(lit("lstat"), user_package), func_n1(lstat_wrap)); - reg_fun(intern(lit("fstat"), user_package), func_n1(fstat_wrap)); #if HAVE_SYS_STAT #ifndef S_IFSOCK |