Make indent

This commit is contained in:
Erica Fischer
2026-05-30 21:22:08 -07:00
parent c4e06dddbd
commit 535519b665
4 changed files with 46 additions and 20 deletions
+37 -11
View File
@@ -97,8 +97,12 @@ struct json_object {
json_type type; json_type type;
json_object(json_type t) : type(t) {} json_object(json_type t)
json_object(json_type t, json_object *p, json_pull *pl) : parent(p), parser(pl), type(t) {} : type(t) {
}
json_object(json_type t, json_object *p, json_pull *pl)
: parent(p), parser(pl), type(t) {
}
// Type-tagged accessors. Each one asserts that the receiver is of // Type-tagged accessors. Each one asserts that the receiver is of
// the right kind, then downcasts to the storage in the appropriate // the right kind, then downcasts to the storage in the appropriate
@@ -135,18 +139,28 @@ struct json_number : json_object {
double d; double d;
unsigned long long u; unsigned long long u;
long long s; long long s;
value_t() : d(0) {} value_t()
: d(0) {
}
} value; } value;
json_number() : json_object(JSON_NUMBER) {} json_number()
json_number(json_object *p, json_pull *pl) : json_object(JSON_NUMBER, p, pl) {} : json_object(JSON_NUMBER) {
}
json_number(json_object *p, json_pull *pl)
: json_object(JSON_NUMBER, p, pl) {
}
}; };
struct json_string : json_object { struct json_string : json_object {
std::string string_value; std::string string_value;
json_string() : json_object(JSON_STRING) {} json_string()
json_string(json_object *p, json_pull *pl) : json_object(JSON_STRING, p, pl) {} : json_object(JSON_STRING) {
}
json_string(json_object *p, json_pull *pl)
: json_object(JSON_STRING, p, pl) {
}
}; };
struct json_array : json_object { struct json_array : json_object {
@@ -158,8 +172,14 @@ struct json_array : json_object {
// shared_ptr copies. Reserving 2 slots up front eliminates those // shared_ptr copies. Reserving 2 slots up front eliminates those
// reallocations for the common case and adds only a single small // reallocations for the common case and adds only a single small
// allocation for larger rings (which still grow geometrically). // allocation for larger rings (which still grow geometrically).
json_array() : json_object(JSON_ARRAY) { array_value.reserve(2); } json_array()
json_array(json_object *p, json_pull *pl) : json_object(JSON_ARRAY, p, pl) { array_value.reserve(2); } : json_object(JSON_ARRAY) {
array_value.reserve(2);
}
json_array(json_object *p, json_pull *pl)
: json_object(JSON_ARRAY, p, pl) {
array_value.reserve(2);
}
}; };
struct json_hash : json_object { struct json_hash : json_object {
@@ -169,8 +189,14 @@ struct json_hash : json_object {
// properties, geometry, plus a few attribute fields). Reserving 4 // properties, geometry, plus a few attribute fields). Reserving 4
// slots avoids the 0 -> 1 -> 2 -> 4 growth chain for the typical // slots avoids the 0 -> 1 -> 2 -> 4 growth chain for the typical
// case while only modestly over-allocating for one-key hashes. // case while only modestly over-allocating for one-key hashes.
json_hash() : json_object(JSON_HASH) { entries_value.reserve(4); } json_hash()
json_hash(json_object *p, json_pull *pl) : json_object(JSON_HASH, p, pl) { entries_value.reserve(4); } : json_object(JSON_HASH) {
entries_value.reserve(4);
}
json_hash(json_object *p, json_pull *pl)
: json_object(JSON_HASH, p, pl) {
entries_value.reserve(4);
}
}; };
inline std::string &json_object::string() { inline std::string &json_object::string() {
+2 -2
View File
@@ -831,7 +831,7 @@ static double choose_minattribute(std::vector<double> &attribute_values, double
if (descending) { if (descending) {
// For descending: drop features > threshold, keep features <= threshold // For descending: drop features > threshold, keep features <= threshold
// ix points at the last value to keep // ix points at the last value to keep
size_t ix = (size_t)((attribute_values.size() - 1) * f); size_t ix = (size_t) ((attribute_values.size() - 1) * f);
while (ix > 0 && attribute_values[ix] >= existing_attribute) { while (ix > 0 && attribute_values[ix] >= existing_attribute) {
ix--; ix--;
} }
@@ -844,7 +844,7 @@ static double choose_minattribute(std::vector<double> &attribute_values, double
} else { } else {
// For ascending: drop features < threshold, keep features >= threshold // For ascending: drop features < threshold, keep features >= threshold
// ix points at the first value to keep // ix points at the first value to keep
size_t ix = (size_t)ceil((double)(attribute_values.size() - 1) * (1 - f)); size_t ix = (size_t) ceil((double) (attribute_values.size() - 1) * (1 - f));
if (ix >= attribute_values.size()) { if (ix >= attribute_values.size()) {
ix = attribute_values.size() - 1; ix = attribute_values.size() - 1;
} }