From 85474df7b3f4ba2060d2c9a9debfb3829b2131d9 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 5 Feb 2016 15:51:47 -0800 Subject: [PATCH] Reverse changes to AVL code --- include/grpc/support/avl.h | 4 ++-- src/core/support/avl.c | 12 ++++++------ test/core/support/avl_test.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h index 623da6698c4..3433124c6fa 100644 --- a/include/grpc/support/avl.h +++ b/include/grpc/support/avl.h @@ -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 */ diff --git a/src/core/support/avl.c b/src/core/support/avl.c index 78746588f0a..9734c9987fe 100644 --- a/src/core/support/avl.c +++ b/src/core/support/avl.c @@ -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; } diff --git a/test/core/support/avl_test.c b/test/core/support/avl_test.c index 6dae53c1dfe..d8d8b36806b 100644 --- a/test/core/support/avl_test.c +++ b/test/core/support/avl_test.c @@ -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); }