Re: [ovs-dev] [PATCHv2 3/4] ovsdb-idl: Avoid new expression.

2017-08-11 Thread Joe Stringer
On 10 August 2017 at 13:30, Ben Pfaff  wrote:
> On Wed, Aug 09, 2017 at 03:27:41PM -0700, Joe Stringer wrote:
>> 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_datum' to
>> avoid this issue.
>>
>> Signed-off-by: Joe Stringer 
>> ---
>> v2: Rebase.
>> Rename 'new_' to 'new_datum'.
>> Update comments above 'struct ovsdb_idl_row'.
>
> Should we rename 'old' to 'old_datum' for consistency?
>
> Acked-by: Ben Pfaff 

Turns out that Zhenyu pointed this out in v1, so yeah:)

I'll add these acks and respin the series.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCHv2 3/4] ovsdb-idl: Avoid new expression.

2017-08-10 Thread Ben Pfaff
On Wed, Aug 09, 2017 at 03:27:41PM -0700, Joe Stringer wrote:
> 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_datum' to
> avoid this issue.
> 
> Signed-off-by: Joe Stringer 
> ---
> v2: Rebase.
> Rename 'new_' to 'new_datum'.
> Update comments above 'struct ovsdb_idl_row'.

Should we rename 'old' to 'old_datum' for consistency?

Acked-by: Ben Pfaff 
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCHv2 3/4] ovsdb-idl: Avoid new expression.

2017-08-09 Thread Joe Stringer
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_datum' to
avoid this issue.

Signed-off-by: Joe Stringer 
---
v2: Rebase.
Rename 'new_' to 'new_datum'.
Update comments above 'struct ovsdb_idl_row'.
---
 lib/ovsdb-data.h |   4 +-
 lib/ovsdb-idl-provider.h |  24 +--
 lib/ovsdb-idl.c  | 103 +--
 3 files changed, 68 insertions(+), 63 deletions(-)

diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h
index 1bf90d59c30f..756219e9f497 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_datum,
   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_datum,
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 aa1fa9390572..94c604620833 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -37,30 +37,30 @@
  * - 'old' points to the data committed to the database and currently
  *   in the row.
  *
- * - 'new == old'.
+ * - 'new_datum == old'.
  *
  * When a transaction is in progress, the situation is a little different.  For
- * a row inserted in the transaction, 'old' is NULL and 'new' points to the
- * row's initial contents.  Otherwise:
+ * a row inserted in the transaction, 'old' is NULL and 'new_datum' points to
+ * the row's initial contents.  Otherwise:
  *
  * - 'old' points to the data committed to the database and currently in
  *   the row.  (This is the same as when no transaction is in progress.)
  *
- * - If the transaction does not modify the row, 'new == old'.
+ * - If the transaction does not modify the row, 'new_datum == old'.
  *
- * - If the transaction modifies the row, 'new' points to the modified
- *   data.
+ * - If the transaction modifies the row, 'new_datum' points to the
+ *   modified data.
  *
- * - If the transaction deletes the row, 'new' is NULL.
+ * - If the transaction deletes the row, 'new_datum' is NULL.
  *
  * Thus:
  *
  * - 'old' always points to committed data, except that it is NULL if the
  *   row is inserted within the current transaction.
  *
- * - 'new' always points to the newest, possibly uncommitted version of the
- *   row's data, except that it is NULL if the row is deleted within the
- *   current transaction.
+ * - 'new_datum' always points to the newest, possibly uncommitted version
+ *   of the row's data, except that it is NULL if the row is deleted within
+ *   the current transaction.
  */
 struct ovsdb_idl_row {
 struct hmap_node hmap_node; /* In struct ovsdb_idl_table's 'rows'. */
@@ -71,9 +71,9 @@ 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_datum; /* 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. */
+unsigned long int *written; /* Bitmap of "new_datum" columns to write. */
 struct hmap_node txn_node;  /* Node in ovsdb_idl_txn's list. */
 unsigned long int *map_op_written; /* Bitmap of columns pending map ops. */
 struct map_op_list **map_op_lists; /* Per-column map operations. */
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index d474075fa990..7b244307ddd7 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -775,11 +775,11 @@ ovsdb_idl_check_consistency(const struct ovsdb_idl *idl)
 const struct ovsdb_idl_row *row;
 HMAP_FOR_EACH (row, hmap_node, >rows) {
 size_t n_dsts = 0;
-if (row->new) {
+if (row->new_datum) {
 size_t n_columns = shash_count(>table->columns);
 for (size_t j = 0; j < n_columns; j++) {
 const struct ovsdb_type *type = >columns[j].type;
-const struct ovsdb_datum *datum = >new[j];
+const struct ovsdb_datum *datum = >new_datum[j];
 add_row_references(>key,
datum->keys,