diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-05 04:24:15 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-05 04:24:15 -0500 |
commit | 15555d497f56e4b4d39e9a14f74b2c82cce52b90 (patch) | |
tree | 1e6c661379f02fdc52ef107fd500438ab69f3e60 /src/option.cc | |
parent | 94b2518c4156e5a6b2be45bdbeeacf1ced0cd17f (diff) | |
parent | 060fc0e00bacb96d1d16163779d98c45c3999014 (diff) | |
download | fork-ledger-15555d497f56e4b4d39e9a14f74b2c82cce52b90.tar.gz fork-ledger-15555d497f56e4b4d39e9a14f74b2c82cce52b90.tar.bz2 fork-ledger-15555d497f56e4b4d39e9a14f74b2c82cce52b90.zip |
Merge branch 'next'
Diffstat (limited to 'src/option.cc')
-rw-r--r-- | src/option.cc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/option.cc b/src/option.cc index 8da66b36..6d230939 100644 --- a/src/option.cc +++ b/src/option.cc @@ -41,8 +41,7 @@ namespace { op_bool_tuple find_option(scope_t& scope, const string& name) { char buf[128]; - std::strcpy(buf, "opt_"); - char * p = &buf[4]; + char * p = buf; foreach (char ch, name) { if (ch == '-') *p++ = '_'; @@ -52,28 +51,27 @@ namespace { *p++ = '_'; *p = '\0'; - if (expr_t::ptr_op_t op = scope.lookup(buf)) + if (expr_t::ptr_op_t op = scope.lookup(symbol_t::OPTION, buf)) return op_bool_tuple(op, true); *--p = '\0'; - return op_bool_tuple(scope.lookup(buf), false); + return op_bool_tuple(scope.lookup(symbol_t::OPTION, buf), false); } op_bool_tuple find_option(scope_t& scope, const char letter) { - char buf[10]; - std::strcpy(buf, "opt_"); - buf[4] = letter; - buf[5] = '_'; - buf[6] = '\0'; + char buf[4]; + buf[0] = letter; + buf[1] = '_'; + buf[2] = '\0'; - if (expr_t::ptr_op_t op = scope.lookup(buf)) + if (expr_t::ptr_op_t op = scope.lookup(symbol_t::OPTION, buf)) return op_bool_tuple(op, true); - buf[5] = '\0'; + buf[1] = '\0'; - return op_bool_tuple(scope.lookup(buf), false); + return op_bool_tuple(scope.lookup(symbol_t::OPTION, buf), false); } void process_option(const string& whence, const function_t& opt, |