In C++, 'new' is a keyword. If this is used as the name for a field,
then C++ compilers can get confused about the context and fail to
compile references to such fields. Rename the field to 'new_' to avoid
this issue.

Signed-off-by: Joe Stringer <j...@ovn.org>
---
 lib/ovsdb-data.h         |  4 +--
 lib/ovsdb-idl-provider.h |  2 +-
 lib/ovsdb-idl.c          | 76 ++++++++++++++++++++++++------------------------
 3 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h
index 1bf90d59c30f..521bc553897a 100644
--- a/lib/ovsdb-data.h
+++ b/lib/ovsdb-data.h
@@ -222,10 +222,10 @@ void ovsdb_datum_subtract(struct ovsdb_datum *a,
 /* Generate and apply diffs */
 void ovsdb_datum_diff(struct ovsdb_datum *diff,
                       const struct ovsdb_datum *old,
-                      const struct ovsdb_datum *new,
+                      const struct ovsdb_datum *new_,
                       const struct ovsdb_type *type);
 
-struct ovsdb_error *ovsdb_datum_apply_diff(struct ovsdb_datum *new,
+struct ovsdb_error *ovsdb_datum_apply_diff(struct ovsdb_datum *new_,
                                            const struct ovsdb_datum *old,
                                            const struct ovsdb_datum *diff,
                                            const struct ovsdb_type *type)
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index 09cff143f07f..3578f89cb07c 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -70,7 +70,7 @@ struct ovsdb_idl_row {
     struct ovsdb_datum *old;    /* Committed data (null if orphaned). */
 
     /* Transactional data. */
-    struct ovsdb_datum *new;    /* Modified data (null to delete row). */
+    struct ovsdb_datum *new_;    /* Modified data (null to delete row). */
     unsigned long int *prereqs; /* Bitmap of columns to verify in "old". */
     unsigned long int *written; /* Bitmap of columns from "new" to write. */
     struct hmap_node txn_node;  /* Node in ovsdb_idl_txn's list. */
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index d0ecad7cf097..41f98a7df74c 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -761,11 +761,11 @@ ovsdb_idl_check_consistency(const struct ovsdb_idl *idl)
         const struct ovsdb_idl_row *row;
         HMAP_FOR_EACH (row, hmap_node, &table->rows) {
             size_t n_dsts = 0;
-            if (row->new) {
+            if (row->new_) {
                 size_t n_columns = shash_count(&row->table->columns);
                 for (size_t j = 0; j < n_columns; j++) {
                     const struct ovsdb_type *type = &class->columns[j].type;
-                    const struct ovsdb_datum *datum = &row->new[j];
+                    const struct ovsdb_datum *datum = &row->new_[j];
                     add_row_references(&type->key,
                                        datum->keys, datum->n, &row->uuid,
                                        &dsts, &n_dsts, &allocated_dsts);
@@ -1978,7 +1978,7 @@ ovsdb_idl_row_apply_diff(struct ovsdb_idl_row *row,
 static bool
 ovsdb_idl_row_is_orphan(const struct ovsdb_idl_row *row)
 {
-    return !row->old && !row->new;
+    return !row->old && !row->new_;
 }
 
 /* Returns true if 'row' is conceptually part of the database as modified by
@@ -2000,7 +2000,7 @@ ovsdb_idl_row_is_orphan(const struct ovsdb_idl_row *row)
 static bool
 ovsdb_idl_row_exists(const struct ovsdb_idl_row *row)
 {
-    return row->new != NULL;
+    return row->new_ != NULL;
 }
 
 static void
@@ -2030,7 +2030,7 @@ ovsdb_idl_row_unparse(struct ovsdb_idl_row *row)
 static void
 ovsdb_idl_row_clear_old(struct ovsdb_idl_row *row)
 {
-    ovs_assert(row->old == row->new);
+    ovs_assert(row->old == row->new_);
     if (!ovsdb_idl_row_is_orphan(row)) {
         const struct ovsdb_idl_table_class *class = row->table->class_;
         size_t i;
@@ -2039,28 +2039,28 @@ ovsdb_idl_row_clear_old(struct ovsdb_idl_row *row)
             ovsdb_datum_destroy(&row->old[i], &class->columns[i].type);
         }
         free(row->old);
-        row->old = row->new = NULL;
+        row->old = row->new_ = NULL;
     }
 }
 
 static void
 ovsdb_idl_row_clear_new(struct ovsdb_idl_row *row)
 {
-    if (row->old != row->new) {
-        if (row->new) {
+    if (row->old != row->new_) {
+        if (row->new_) {
             const struct ovsdb_idl_table_class *class = row->table->class_;
             size_t i;
 
             if (row->written) {
                 BITMAP_FOR_EACH_1 (i, class->n_columns, row->written) {
-                    ovsdb_datum_destroy(&row->new[i], &class->columns[i].type);
+                    ovsdb_datum_destroy(&row->new_[i], 
&class->columns[i].type);
                 }
             }
-            free(row->new);
+            free(row->new_);
             free(row->written);
             row->written = NULL;
         }
-        row->new = row->old;
+        row->new_ = row->old;
     }
 }
 
@@ -2226,8 +2226,8 @@ ovsdb_idl_insert_row(struct ovsdb_idl_row *row, const 
struct json *row_json)
     const struct ovsdb_idl_table_class *class = row->table->class_;
     size_t i;
 
-    ovs_assert(!row->old && !row->new);
-    row->old = row->new = xmalloc(class->n_columns * sizeof *row->old);
+    ovs_assert(!row->old && !row->new_);
+    row->old = row->new_ = xmalloc(class->n_columns * sizeof *row->old);
     for (i = 0; i < class->n_columns; i++) {
         ovsdb_datum_init_default(&row->old[i], &class->columns[i].type);
     }
@@ -2330,7 +2330,7 @@ ovsdb_idl_get_row_arc(struct ovsdb_idl_row *src,
          *
          * Just return the destination row, if there is one and it has not been
          * deleted. */
-        if (dst && (hmap_node_is_null(&dst->txn_node) || dst->new)) {
+        if (dst && (hmap_node_is_null(&dst->txn_node) || dst->new_)) {
             return dst;
         }
         return NULL;
@@ -2427,11 +2427,11 @@ ovsdb_idl_read(const struct ovsdb_idl_row *row,
     class = row->table->class_;
     column_idx = column - class->columns;
 
-    ovs_assert(row->new != NULL);
+    ovs_assert(row->new_ != NULL);
     ovs_assert(column_idx < class->n_columns);
 
     if (row->written && bitmap_is_set(row->written, column_idx)) {
-        return &row->new[column_idx];
+        return &row->new_[column_idx];
     } else if (row->old) {
         return &row->old[column_idx];
     } else {
@@ -2470,7 +2470,7 @@ bool
 ovsdb_idl_is_mutable(const struct ovsdb_idl_row *row,
                      const struct ovsdb_idl_column *column)
 {
-    return column->mutable || (row->new && !row->old);
+    return column->mutable || (row->new_ && !row->old);
 }
 
 /* Returns false if 'row' was obtained from the IDL, true if it was initialized
@@ -2699,7 +2699,7 @@ substitute_uuids(struct json *json, const struct 
ovsdb_idl_txn *txn)
             const struct ovsdb_idl_row *row;
 
             row = ovsdb_idl_txn_get_row(txn, &uuid);
-            if (row && !row->old && row->new) {
+            if (row && !row->old && row->new_) {
                 json_destroy(json);
 
                 return json_array_create_2(
@@ -2788,8 +2788,8 @@ ovsdb_idl_txn_extract_mutations(struct ovsdb_idl_row *row,
             value_type = column->type.value.type;
 
             /* Get the value to be changed */
-            if (row->new && row->written && bitmap_is_set(row->written,idx)) {
-                old_datum = &row->new[idx];
+            if (row->new_ && row->written && bitmap_is_set(row->written,idx)) {
+                old_datum = &row->new_[idx];
             } else if (row->old != NULL) {
                 old_datum = &row->old[idx];
             } else {
@@ -2896,8 +2896,8 @@ ovsdb_idl_txn_extract_mutations(struct ovsdb_idl_row *row,
             key_type = column->type.key.type;
 
             /* Get the value to be changed */
-            if (row->new && row->written && bitmap_is_set(row->written,idx)) {
-                old_datum = &row->new[idx];
+            if (row->new_ && row->written && bitmap_is_set(row->written,idx)) {
+                old_datum = &row->new_[idx];
             } else if (row->old != NULL) {
                 old_datum = &row->old[idx];
             } else {
@@ -3072,7 +3072,7 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
     HMAP_FOR_EACH (row, txn_node, &txn->txn_rows) {
         const struct ovsdb_idl_table_class *class = row->table->class_;
 
-        if (!row->new) {
+        if (!row->new_) {
             if (class->is_root) {
                 struct json *op = json_object_create();
                 json_object_put_string(op, "op", "delete");
@@ -3083,7 +3083,7 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
             } else {
                 /* Let ovsdb-server decide whether to really delete it. */
             }
-        } else if (row->old != row->new) {
+        } else if (row->old != row->new_) {
             struct json *row_json;
             struct json *op;
             size_t idx;
@@ -3118,11 +3118,11 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
                                                         &class->columns[idx];
 
                     if (row->old
-                        || !ovsdb_datum_is_default(&row->new[idx],
+                        || !ovsdb_datum_is_default(&row->new_[idx],
                                                   &column->type)) {
                         json_object_put(row_json, column->name,
                                         substitute_uuids(
-                                            ovsdb_datum_to_json(&row->new[idx],
+                                            
ovsdb_datum_to_json(&row->new_[idx],
                                                                 &column->type),
                                             txn));
 
@@ -3131,7 +3131,7 @@ ovsdb_idl_txn_commit(struct ovsdb_idl_txn *txn)
                          * or transactions would become nonatomic (see the big
                          * comment inside ovsdb_idl_txn_write()). */
                         if (!any_updates && row->old &&
-                            !ovsdb_datum_equals(&row->old[idx], &row->new[idx],
+                            !ovsdb_datum_equals(&row->old[idx], 
&row->new_[idx],
                                                 &column->type)) {
                             any_updates = true;
                         }
@@ -3370,7 +3370,7 @@ ovsdb_idl_txn_write__(const struct ovsdb_idl_row *row_,
     column_idx = column - class->columns;
     write_only = row->table->modes[column_idx] == OVSDB_IDL_MONITOR;
 
-    ovs_assert(row->new != NULL);
+    ovs_assert(row->new_ != NULL);
     ovs_assert(column_idx < class->n_columns);
     ovs_assert(row->old == NULL ||
                row->table->modes[column_idx] & OVSDB_IDL_MONITOR);
@@ -3401,24 +3401,24 @@ ovsdb_idl_txn_write__(const struct ovsdb_idl_row *row_,
         hmap_insert(&row->table->idl->txn->txn_rows, &row->txn_node,
                     uuid_hash(&row->uuid));
     }
-    if (row->old == row->new) {
-        row->new = xmalloc(class->n_columns * sizeof *row->new);
+    if (row->old == row->new_) {
+        row->new_ = xmalloc(class->n_columns * sizeof *row->new_);
     }
     if (!row->written) {
         row->written = bitmap_allocate(class->n_columns);
     }
     if (bitmap_is_set(row->written, column_idx)) {
-        ovsdb_datum_destroy(&row->new[column_idx], &column->type);
+        ovsdb_datum_destroy(&row->new_[column_idx], &column->type);
     } else {
         bitmap_set1(row->written, column_idx);
     }
     if (owns_datum) {
-        row->new[column_idx] = *datum;
+        row->new_[column_idx] = *datum;
     } else {
-        ovsdb_datum_clone(&row->new[column_idx], datum, &column->type);
+        ovsdb_datum_clone(&row->new_[column_idx], datum, &column->type);
     }
     (column->unparse)(row);
-    (column->parse)(row, &row->new[column_idx]);
+    (column->parse)(row, &row->new_[column_idx]);
     return;
 
 discard_datum:
@@ -3511,7 +3511,7 @@ ovsdb_idl_txn_verify(const struct ovsdb_idl_row *row_,
     class = row->table->class_;
     column_idx = column - class->columns;
 
-    ovs_assert(row->new != NULL);
+    ovs_assert(row->new_ != NULL);
     ovs_assert(row->old == NULL ||
                row->table->modes[column_idx] & OVSDB_IDL_MONITOR);
     if (!row->old
@@ -3545,7 +3545,7 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_)
         return;
     }
 
-    ovs_assert(row->new != NULL);
+    ovs_assert(row->new_ != NULL);
     if (!row->old) {
         ovsdb_idl_row_unparse(row);
         ovsdb_idl_row_clear_new(row);
@@ -3560,7 +3560,7 @@ ovsdb_idl_txn_delete(const struct ovsdb_idl_row *row_)
                     uuid_hash(&row->uuid));
     }
     ovsdb_idl_row_clear_new(row);
-    row->new = NULL;
+    row->new_ = NULL;
 }
 
 /* Inserts and returns a new row in the table with the specified 'class' in the
@@ -3590,7 +3590,7 @@ ovsdb_idl_txn_insert(struct ovsdb_idl_txn *txn,
     }
 
     row->table = ovsdb_idl_table_from_class(txn->idl, class);
-    row->new = xmalloc(class->n_columns * sizeof *row->new);
+    row->new_ = xmalloc(class->n_columns * sizeof *row->new_);
     hmap_insert(&row->table->rows, &row->hmap_node, uuid_hash(&row->uuid));
     hmap_insert(&txn->txn_rows, &row->txn_node, uuid_hash(&row->uuid));
     return row;
-- 
2.13.3

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to