From: Ben Pfaff Date: Tue, 27 Apr 2010 00:01:55 +0000 (-0700) Subject: Make more header files C++ compatible. X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=26260067013cd98ff1a0e32d1b8b9cda6afd7b71;p=sliver-openvswitch.git Make more header files C++ compatible. From partner, with minor changes. --- diff --git a/lib/classifier.h b/lib/classifier.h index 651986d1a..53dfc88c7 100644 --- a/lib/classifier.h +++ b/lib/classifier.h @@ -46,6 +46,10 @@ #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 */ diff --git a/lib/hash.h b/lib/hash.h index 5f6409cb1..40e429d2a 100644 --- a/lib/hash.h +++ b/lib/hash.h @@ -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. @@ -22,6 +22,10 @@ #include #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 */ diff --git a/lib/hmap.h b/lib/hmap.h index 2f4a302fa..7aa772639 100644 --- a/lib/hmap.h +++ b/lib/hmap.h @@ -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. *