aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbbot/manifest.cxx16
-rw-r--r--libbbot/manifest.hxx4
2 files changed, 14 insertions, 6 deletions
diff --git a/libbbot/manifest.cxx b/libbbot/manifest.cxx
index ab392e4..45a4668 100644
--- a/libbbot/manifest.cxx
+++ b/libbbot/manifest.cxx
@@ -276,8 +276,9 @@ namespace bbot
ram_minimum = parse_uint64 (v);
- if (!ram_minimum)
- bad_value ("machine minimum RAM should be 64-bit unsigned integer");
+ if (!ram_minimum || *ram_minimum == 0)
+ bad_value (
+ "machine minimum RAM should be non-zero 64-bit unsigned integer");
}
else if (n == "ram-maximum")
{
@@ -286,8 +287,9 @@ namespace bbot
ram_maximum = parse_uint64 (v);
- if (!ram_maximum)
- bad_value ("machine maximum RAM should be 64-bit unsigned integer");
+ if (!ram_maximum || *ram_maximum == 0)
+ bad_value (
+ "machine maximum RAM should be non-zero 64-bit unsigned integer");
}
else
{
@@ -333,10 +335,16 @@ namespace bbot
s.next ("role", to_string (*role));
if (ram_minimum)
+ {
+ assert (*ram_minimum != 0);
s.next ("ram-minimum", std::to_string (*ram_minimum));
+ }
if (ram_maximum)
+ {
+ assert (*ram_maximum != 0);
s.next ("ram-maximum", std::to_string (*ram_maximum));
+ }
if (end_of_manifest)
s.next ("", ""); // End of manifest.
diff --git a/libbbot/manifest.hxx b/libbbot/manifest.hxx
index a815d3e..909d47d 100644
--- a/libbbot/manifest.hxx
+++ b/libbbot/manifest.hxx
@@ -52,8 +52,8 @@ namespace bbot
std::string name;
std::string summary;
butl::optional<machine_role> role;
- butl::optional<std::uint64_t> ram_minimum; // In KiB.
- butl::optional<std::uint64_t> ram_maximum; // In KiB.
+ butl::optional<std::uint64_t> ram_minimum; // In KiB, non-zero.
+ butl::optional<std::uint64_t> ram_maximum; // In KiB, non-zero.
// Return the effective machine role. If the role is not explicitly
// specified, then the build role is assumed.