Reverse changes to AVL code

pull/5088/head
murgatroid99 9 years ago
parent b3ac991d9e
commit 85474df7b3
  1. 4
      include/grpc/support/avl.h
  2. 12
      src/core/support/avl.c
  3. 2
      test/core/support/avl_test.c

@ -43,7 +43,7 @@ typedef struct gpr_avl_node {
void *value;
struct gpr_avl_node *left;
struct gpr_avl_node *right;
int64_t height;
long height;
} gpr_avl_node;
typedef struct gpr_avl_vtable {
@ -53,7 +53,7 @@ typedef struct gpr_avl_vtable {
void *(*copy_key)(void *key);
/** compare key1, key2; return <0 if key1 < key2,
>0 if key1 > key2, 0 if key1 == key2 */
int64_t (*compare_keys)(void *key1, void *key2);
long (*compare_keys)(void *key1, void *key2);
/** destroy a value */
void (*destroy_value)(void *value);
/** copy a value */

@ -1,6 +1,6 @@
/*
*
* Copyright 2015-2016, Google Inc.
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -67,12 +67,12 @@ static void unref_node(const gpr_avl_vtable *vtable, gpr_avl_node *node) {
}
}
static int64_t node_height(gpr_avl_node *node) {
static long node_height(gpr_avl_node *node) {
return node == NULL ? 0 : node->height;
}
#ifndef NDEBUG
static int64_t calculate_height(gpr_avl_node *node) {
static long calculate_height(gpr_avl_node *node) {
return node == NULL ? 0 : 1 + GPR_MAX(calculate_height(node->left),
calculate_height(node->right));
}
@ -103,7 +103,7 @@ gpr_avl_node *new_node(void *key, void *value, gpr_avl_node *left,
static gpr_avl_node *get(const gpr_avl_vtable *vtable, gpr_avl_node *node,
void *key) {
int64_t cmp;
long cmp;
if (node == NULL) {
return NULL;
@ -198,7 +198,7 @@ static gpr_avl_node *rebalance(const gpr_avl_vtable *vtable, void *key,
static gpr_avl_node *add(const gpr_avl_vtable *vtable, gpr_avl_node *node,
void *key, void *value) {
int64_t cmp;
long cmp;
if (node == NULL) {
return new_node(key, value, NULL, NULL);
}
@ -240,7 +240,7 @@ static gpr_avl_node *in_order_tail(gpr_avl_node *node) {
static gpr_avl_node *remove(const gpr_avl_vtable *vtable, gpr_avl_node *node,
void *key) {
int64_t cmp;
long cmp;
if (node == NULL) {
return NULL;
}

@ -48,7 +48,7 @@ static int *box(int x) {
return b;
}
static int64_t int_compare(void *int1, void *int2) {
static long int_compare(void *int1, void *int2) {
return (*(int *)int1) - (*(int *)int2);
}
static void *int_copy(void *p) { return box(*(int *)p); }

Loading…
Cancel
Save