blob: f6b557848b015d749b90eb3570176a04bf56b649 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "basic_value.h"
#include <vespa/vespalib/util/stash.h>
namespace vespalib::slime {
namespace {
Memory
store(Memory m, Stash & stash)
{
char * buf = stash.alloc(m.size);
if (m.data) {
memcpy(buf, m.data, m.size);
}
return Memory(buf, m.size);
}
}
BasicStringValue::BasicStringValue(Memory m, Stash & stash)
: _value(store(m, stash))
{
}
BasicDataValue::BasicDataValue(Memory m, Stash & stash)
: _value(store(m, stash))
{
}
} // namespace vespalib::slime
|