aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-01-25 13:24:03 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-02-02 09:16:44 -0800
commitd4d0a30c6f569e031d0bfaa31f0410b855f362a3 (patch)
tree84f3a69aaf14cdf2e0c6d4204b752f5555da6f27 /include
parente5b0a504167fbc6277d034709aa29ea07fa09a00 (diff)
Privatize useful.h and avl.h
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/server_builder.h1
-rw-r--r--include/grpc/module.modulemap2
-rw-r--r--include/grpc/support/avl.h102
-rw-r--r--include/grpc/support/useful.h65
4 files changed, 0 insertions, 170 deletions
diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h
index e2bae4b41f..ea9834c179 100644
--- a/include/grpc++/server_builder.h
+++ b/include/grpc++/server_builder.h
@@ -30,7 +30,6 @@
#include <grpc++/support/config.h>
#include <grpc/compression.h>
#include <grpc/support/cpu.h>
-#include <grpc/support/useful.h>
#include <grpc/support/workaround_list.h>
struct grpc_resource_quota;
diff --git a/include/grpc/module.modulemap b/include/grpc/module.modulemap
index d23072f556..6c3fff030e 100644
--- a/include/grpc/module.modulemap
+++ b/include/grpc/module.modulemap
@@ -4,7 +4,6 @@ framework module grpc {
header "support/alloc.h"
header "support/atm.h"
- header "support/avl.h"
header "support/cmdline.h"
header "support/cpu.h"
header "support/host_port.h"
@@ -18,7 +17,6 @@ framework module grpc {
header "support/thd.h"
header "support/time.h"
header "support/tls.h"
- header "support/useful.h"
header "impl/codegen/atm.h"
header "impl/codegen/fork.h"
header "impl/codegen/gpr_slice.h"
diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h
deleted file mode 100644
index b5a8c0ffa1..0000000000
--- a/include/grpc/support/avl.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_AVL_H
-#define GRPC_SUPPORT_AVL_H
-
-#include <grpc/support/sync.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** internal node of an AVL tree */
-typedef struct gpr_avl_node {
- gpr_refcount refs;
- void* key;
- void* value;
- struct gpr_avl_node* left;
- struct gpr_avl_node* right;
- long height;
-} gpr_avl_node;
-
-/** vtable for the AVL tree
- * The optional user_data is propagated from the top level gpr_avl_XXX API.
- * From the same API call, multiple vtable functions may be called multiple
- * times.
- */
-typedef struct gpr_avl_vtable {
- /** destroy a key */
- void (*destroy_key)(void* key, void* user_data);
- /** copy a key, returning new value */
- void* (*copy_key)(void* key, void* user_data);
- /** compare key1, key2; return <0 if key1 < key2,
- >0 if key1 > key2, 0 if key1 == key2 */
- long (*compare_keys)(void* key1, void* key2, void* user_data);
- /** destroy a value */
- void (*destroy_value)(void* value, void* user_data);
- /** copy a value */
- void* (*copy_value)(void* value, void* user_data);
-} gpr_avl_vtable;
-
-/** "pointer" to an AVL tree - this is a reference
- counted object - use gpr_avl_ref to add a reference,
- gpr_avl_unref when done with a reference */
-typedef struct gpr_avl {
- const gpr_avl_vtable* vtable;
- gpr_avl_node* root;
-} gpr_avl;
-
-/** Create an immutable AVL tree. */
-GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable);
-/** Add a reference to an existing tree - returns
- the tree as a convenience. The optional user_data will be passed to vtable
- functions. */
-GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data);
-/** Remove a reference to a tree - destroying it if there
- are no references left. The optional user_data will be passed to vtable
- functions. */
-GPRAPI void gpr_avl_unref(gpr_avl avl, void* user_data);
-/** Return a new tree with (key, value) added to avl.
- implicitly unrefs avl to allow easy chaining.
- if key exists in avl, the new tree's key entry updated
- (i.e. a duplicate is not created). The optional user_data will be passed to
- vtable functions. */
-GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value,
- void* user_data);
-/** Return a new tree with key deleted
- implicitly unrefs avl to allow easy chaining. The optional user_data will be
- passed to vtable functions. */
-GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data);
-/** Lookup key, and return the associated value.
- Does not mutate avl.
- Returns NULL if key is not found. The optional user_data will be passed to
- vtable functions.*/
-GPRAPI void* gpr_avl_get(gpr_avl avl, void* key, void* user_data);
-/** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to
- its value. THe optional user_data will be passed to vtable functions. */
-GPRAPI int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value,
- void* user_data);
-/** Return 1 if avl is empty, 0 otherwise */
-GPRAPI int gpr_avl_is_empty(gpr_avl avl);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* GRPC_SUPPORT_AVL_H */
diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h
deleted file mode 100644
index bd66d3bb27..0000000000
--- a/include/grpc/support/useful.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef GRPC_SUPPORT_USEFUL_H
-#define GRPC_SUPPORT_USEFUL_H
-
-/** useful macros that don't belong anywhere else */
-
-#define GPR_MIN(a, b) ((a) < (b) ? (a) : (b))
-#define GPR_MAX(a, b) ((a) > (b) ? (a) : (b))
-#define GPR_CLAMP(a, min, max) ((a) < (min) ? (min) : (a) > (max) ? (max) : (a))
-/** rotl, rotr assume x is unsigned */
-#define GPR_ROTL(x, n) (((x) << (n)) | ((x) >> (sizeof(x) * 8 - (n))))
-#define GPR_ROTR(x, n) (((x) >> (n)) | ((x) << (sizeof(x) * 8 - (n))))
-
-#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array)))
-
-#define GPR_SWAP(type, a, b) \
- do { \
- type x = a; \
- a = b; \
- b = x; \
- } while (0)
-
-/** Set the \a n-th bit of \a i (a mutable pointer). */
-#define GPR_BITSET(i, n) ((*(i)) |= (1u << (n)))
-
-/** Clear the \a n-th bit of \a i (a mutable pointer). */
-#define GPR_BITCLEAR(i, n) ((*(i)) &= ~(1u << (n)))
-
-/** Get the \a n-th bit of \a i */
-#define GPR_BITGET(i, n) (((i) & (1u << (n))) != 0)
-
-#define GPR_INTERNAL_HEXDIGIT_BITCOUNT(x) \
- ((x) - (((x) >> 1) & 0x77777777) - (((x) >> 2) & 0x33333333) - \
- (((x) >> 3) & 0x11111111))
-
-/** Returns number of bits set in bitset \a i */
-#define GPR_BITCOUNT(i) \
- (((GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) + \
- (GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) >> 4)) & \
- 0x0f0f0f0f) % \
- 255)
-
-#define GPR_ICMP(a, b) ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0))
-
-#define GPR_HASH_POINTER(x, range) \
- ((((size_t)x) >> 4) ^ (((size_t)x) >> 9) ^ (((size_t)x) >> 14)) % (range)
-
-#endif /* GRPC_SUPPORT_USEFUL_H */