Make more header files C++ compatible.
authorBen Pfaff <blp@nicira.com>
Tue, 27 Apr 2010 00:01:55 +0000 (17:01 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 27 Apr 2010 00:01:55 +0000 (17:01 -0700)
From partner, with minor changes.

lib/classifier.h
lib/hash.h
lib/hmap.h

index 651986d..53dfc88 100644 (file)
 #include "list.h"
 #include "openflow/openflow.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 /* Number of bytes of fields in a rule. */
 #define CLS_N_BYTES 31
 
@@ -126,9 +130,9 @@ void cls_rule_from_match(struct cls_rule *, unsigned int priority,
 char *cls_rule_to_string(const struct cls_rule *);
 void cls_rule_print(const struct cls_rule *);
 void cls_rule_moved(struct classifier *,
-                    struct cls_rule *old, struct cls_rule *new);
-void cls_rule_replace(struct classifier *, const struct cls_rule *old,
-                      struct cls_rule *new);
+                    struct cls_rule *old_rule, struct cls_rule *new_rule);
+void cls_rule_replace(struct classifier *, const struct cls_rule *old_rule,
+                      struct cls_rule *new_rule);
 
 void classifier_init(struct classifier *);
 void classifier_destroy(struct classifier *);
@@ -160,4 +164,8 @@ void classifier_for_each_match(const struct classifier *, const flow_t *,
 struct cls_rule *classifier_find_rule_exactly(const struct classifier *,
                                               const flow_t *target);
 
+#ifdef  __cplusplus
+}
+#endif
+
 #endif /* classifier.h */
index 5f6409c..40e429d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010 Nicira Networks.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <string.h>
 #include "util.h"
 
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
 /* This is the public domain lookup3 hash by Bob Jenkins from
  * http://burtleburtle.net/bob/c/lookup3.c, modified for style. */
 
@@ -76,8 +80,8 @@ static inline uint32_t hash_int(uint32_t x, uint32_t basis)
  * quality. */
 static inline uint32_t hash_boolean(bool x, uint32_t basis)
 {
-    enum { P0 = 0xc2b73583 };   /* This is hash_int(1, 0). */
-    enum { P1 = 0xe90f1258 };   /* This is hash_int(2, 0). */
+    const uint32_t P0 = 0xc2b73583; /* This is hash_int(1, 0). */
+    const uint32_t P1 = 0xe90f1258; /* This is hash_int(2, 0). */
     return (x ? P0 : P1) ^ HASH_ROT(basis, 1);
 }
 
@@ -103,4 +107,8 @@ static inline uint32_t hash_pointer(const void *p, uint32_t basis)
     return hash_int((uint32_t) (uintptr_t) p, basis);
 }
 
+#ifdef  __cplusplus
+}
+#endif
+
 #endif /* hash.h */
index 2f4a302..7aa7726 100644 (file)
@@ -87,7 +87,7 @@ static inline void hmap_remove(struct hmap *, struct hmap_node *);
 
 void hmap_node_moved(struct hmap *, struct hmap_node *, struct hmap_node *);
 static inline void hmap_replace(struct hmap *, const struct hmap_node *old,
-                                struct hmap_node *new);
+                                struct hmap_node *new_node);
 
 /* Search.
  *