util,test: remove definition and usage of type 'ssize_t'
This commit is contained in:
parent
7080d540e2
commit
027fb4a419
@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
#ifndef _SSIZE_T_DEFINED
|
|
||||||
typedef intptr_t ssize_t;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define array_count(a) (sizeof(a) / (sizeof((a)[0])))
|
#define array_count(a) (sizeof(a) / (sizeof((a)[0])))
|
||||||
|
|
||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include "test-util.h"
|
#include "test-util.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
#include "util.h"
|
|
||||||
|
|
||||||
#define NODE_COUNT 1000
|
#define NODE_COUNT 1000
|
||||||
static_assert(NODE_COUNT <= RAND_MAX, "NODE_COUNT too high");
|
static_assert(NODE_COUNT <= RAND_MAX, "NODE_COUNT too high");
|
||||||
@ -54,21 +53,21 @@ static void check_tree_count(const tree_t* tree, size_t expected_count) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void keys_increasing(tree_t* tree, test_op_t op) {
|
static void keys_increasing(tree_t* tree, test_op_t op) {
|
||||||
size_t i;
|
uintptr_t i;
|
||||||
for (i = 0; i < NODE_COUNT; i++)
|
for (i = 0; i < NODE_COUNT; i++)
|
||||||
op(tree, i);
|
op(tree, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keys_decreasing(tree_t* tree, test_op_t op) {
|
static void keys_decreasing(tree_t* tree, test_op_t op) {
|
||||||
ssize_t i;
|
intptr_t i;
|
||||||
for (i = NODE_COUNT - 1; i >= 0; i--)
|
for (i = NODE_COUNT - 1; i >= 0; i--)
|
||||||
op(tree, (size_t) i);
|
op(tree, (uintptr_t) i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void keys_random(tree_t* tree, test_op_t op) {
|
static void keys_random(tree_t* tree, test_op_t op) {
|
||||||
uintptr_t keys[NODE_COUNT];
|
uintptr_t keys[NODE_COUNT];
|
||||||
uintptr_t index, key;
|
uintptr_t index, key;
|
||||||
ssize_t left;
|
intptr_t left;
|
||||||
|
|
||||||
for (index = 0; index < NODE_COUNT; index++)
|
for (index = 0; index < NODE_COUNT; index++)
|
||||||
keys[index] = index;
|
keys[index] = index;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user