X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=ovsdb%2Fovsdb-idlc.in;h=9a235e27e5d97cb9fe05e4c31320c538f961c2fc;hb=e89e5374bebd6ae00098ce40511a36daa09fc77e;hp=e99917a89105d20b738bc5d56c41eb6b7ab10917;hpb=8936565369410daa099708be4cd3fa7e0e39bade;p=openvswitch diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in index e99917a8..9a235e27 100755 --- a/ovsdb/ovsdb-idlc.in +++ b/ovsdb/ovsdb-idlc.in @@ -158,7 +158,14 @@ def printCIDLHeader(schemaFile): print ''' const struct %(s)s *%(s)s_first(const struct ovsdb_idl *); const struct %(s)s *%(s)s_next(const struct %(s)s *); -#define %(S)s_FOR_EACH(ROW, IDL) for ((ROW) = %(s)s_first(IDL); (ROW); (ROW) = %(s)s_next(ROW)) +#define %(S)s_FOR_EACH(ROW, IDL) \\ + for ((ROW) = %(s)s_first(IDL); \\ + (ROW); \\ + (ROW) = %(s)s_next(ROW)) +#define %(S)s_FOR_EACH_SAFE(ROW, NEXT, IDL) \\ + for ((ROW) = %(s)s_first(IDL); \\ + (ROW) ? ((NEXT) = %(s)s_next(ROW), 1) : 0; \\ + (ROW) = (NEXT)) void %(s)s_delete(const struct %(s)s *); struct %(s)s *%(s)s_insert(struct ovsdb_idl_txn *); @@ -231,10 +238,7 @@ static struct %(s)s * for tableName, table in sorted(schema.tables.iteritems()): structName = "%s%s" % (prefix, tableName.lower()) print " " - if table.comment != None: - print "/* %s table (%s). */" % (tableName, table.comment) - else: - print "/* %s table. */" % (tableName) + print "/* %s table. */" % (tableName) # Parse functions. for columnName, column in sorted(table.columns.iteritems()): @@ -307,7 +311,7 @@ static void print "%sif (!row->n_%s) {" % (indent, columnName) print "%s %s = xmalloc(%s * sizeof *%s);" % (indent, keyVar, nMax, keyVar) if valueVar: - print "%s %s = xmalloc(%s * sizeof %s);" % (indent, valueVar, nMax, valueVar) + print "%s %s = xmalloc(%s * sizeof *%s);" % (indent, valueVar, nMax, valueVar) print "%s}" % indent print "%s%s[row->n_%s] = %s;" % (indent, keyVar, columnName, keySrc) if valueVar: @@ -374,7 +378,7 @@ void struct %(s)s * %(s)s_insert(struct ovsdb_idl_txn *txn) { - return %(s)s_cast(ovsdb_idl_txn_insert(txn, &%(p)stable_classes[%(P)sTABLE_%(T)s])); + return %(s)s_cast(ovsdb_idl_txn_insert(txn, &%(p)stable_classes[%(P)sTABLE_%(T)s], NULL)); } ''' % {'s': structName, 'p': prefix,