summaryrefslogtreecommitdiff
path: root/src/value.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-12 02:35:22 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-12 02:35:22 -0400
commit9344598eb04fb40947b132fd06468d98d737eb07 (patch)
tree51d8ddac5a7179df2f3879a566350258ecebf638 /src/value.h
parentf8c48d7a6f44e5498505b35fd7256f70b4c35cab (diff)
downloadfork-ledger-9344598eb04fb40947b132fd06468d98d737eb07.tar.gz
fork-ledger-9344598eb04fb40947b132fd06468d98d737eb07.tar.bz2
fork-ledger-9344598eb04fb40947b132fd06468d98d737eb07.zip
Inlined value_t::_clear(), since it only had one caller.
Diffstat (limited to 'src/value.h')
-rw-r--r--src/value.h26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/value.h b/src/value.h
index 8e144bb7..02c338f2 100644
--- a/src/value.h
+++ b/src/value.h
@@ -227,30 +227,19 @@ private:
intrusive_ptr<storage_t> storage;
/**
- * _dup() makes a private copy of the current value (if necessary)
- * so it can subsequently be modified.
- *
- * _clear() removes our pointer to the current value and initializes
- * a new storage bin for things to be stored in.
+ * Make a private copy of the current value (if necessary) so it can
+ * subsequently be modified.
*/
void _dup() {
assert(storage);
if (storage->refc > 1)
storage = new storage_t(*storage.get());
}
- void _clear() {
- if (! storage || storage->refc > 1) {
- storage = new storage_t;
- } else {
- storage->data = false; // destruct any other type
- storage->type = VOID;
- }
- }
/**
- * Because boolean "true" and "false" are so common, a pair of
- * static references are kept to prevent the creation of throwaway
- * storage_t objects just to represent these two common values.
+ * Because boolean "true" and "false" are so common, a pair of static
+ * references are kept to prevent the creation of throwaway storage_t
+ * objects just to represent these two common values.
*/
static intrusive_ptr<storage_t> true_value;
static intrusive_ptr<storage_t> false_value;
@@ -480,7 +469,10 @@ private:
#endif
assert(is_null());
} else {
- _clear();
+ if (! storage || storage->refc > 1)
+ storage = new storage_t;
+ else
+ storage->data = false; // destruct all other types
storage->type = new_type;
assert(is_type(new_type));
}