#include "dynamic-string.h"
#include "hash.h"
+#include "ovs-thread.h"
#include "ovsdb-error.h"
#include "ovsdb-parser.h"
#include "json.h"
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
atom->integer = 0;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
ovsdb_atom_default(enum ovsdb_atomic_type type)
{
static union ovsdb_atom default_atoms[OVSDB_N_TYPES];
- static bool inited;
+ static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
- if (!inited) {
+ if (ovsthread_once_start(&once)) {
int i;
for (i = 0; i < OVSDB_N_TYPES; i++) {
ovsdb_atom_init_default(&default_atoms[i], i);
}
}
- inited = true;
+ ovsthread_once_done(&once);
}
ovs_assert(ovsdb_atomic_type_is_valid(type));
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return atom->integer == 0;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
new->integer = old->integer;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return hash_int(atom->integer, basis);
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return a->integer < b->integer ? -1 : a->integer > b->integer;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
if (json->type == JSON_INTEGER) {
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
return ovsdb_syntax_error(json, NULL, "expected %s",
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return json_integer_create(atom->integer);
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
json.type = JSON_INTEGER;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
return json_serialized_length(&json);
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER: {
long long int integer;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
return NULL;
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
ds_put_format(out, "%"PRId64, atom->integer);
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
if (n_chars < c->minLen) {
return ovsdb_error(
"constraint violation",
- "\"%s\" length %zu is less than minimum allowed "
+ "\"%s\" length %"PRIuSIZE" is less than minimum allowed "
"length %u", s, n_chars, c->minLen);
} else if (n_chars > c->maxLen) {
return ovsdb_error(
"constraint violation",
- "\"%s\" length %zu is greater than maximum allowed "
+ "\"%s\" length %"PRIuSIZE" is greater than maximum allowed "
"length %u", s, n_chars, c->maxLen);
}
switch (base->type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_INTEGER:
if (atom->integer >= base->u.integer.min
"value %"PRId64,
atom->integer, base->u.integer.max);
}
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_REAL:
if (atom->real >= base->u.real.min && atom->real <= base->u.real.max) {
DBL_DIG, atom->real,
DBL_DIG, base->u.real.max);
}
- NOT_REACHED();
+ OVS_NOT_REACHED();
case OVSDB_TYPE_BOOLEAN:
return NULL;
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
\f
}
return d;
} else {
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
{
struct ovsdb_error *error = ovsdb_datum_sort(datum, key_type);
if (error) {
- NOT_REACHED();
+ OVS_NOT_REACHED();
}
}
n = inner->u.array.n;
if (n < type->n_min || n > type->n_max) {
return ovsdb_syntax_error(json, NULL, "%s must have %u to "
- "%u members but %zu are present",
+ "%u members but %"PRIuSIZE" are present",
class, type->n_min, type->n_max, n);
}