mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Fixes for the tree234 unit test: break its dependencies on half of the
rest of PuTTY, and fix a couple of format string type mismatches pointed out by gcc. [originally from svn r9911]
This commit is contained in:
parent
3d69dd2071
commit
84fed5c620
13
tree234.c
13
tree234.c
@ -29,12 +29,18 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "puttymem.h"
|
|
||||||
#include "tree234.h"
|
#include "tree234.h"
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
#define LOG(x) (printf x)
|
#define LOG(x) (printf x)
|
||||||
|
#define snew(type) ((type *)malloc(sizeof(type)))
|
||||||
|
#define snewn(n, type) ((type *)malloc((n) * sizeof(type)))
|
||||||
|
#define sresize(ptr, n, type) \
|
||||||
|
((type *)realloc(sizeof((type *)0 == (ptr)) ? (ptr) : (ptr), \
|
||||||
|
(n) * sizeof(type)))
|
||||||
|
#define sfree(ptr) free(ptr)
|
||||||
#else
|
#else
|
||||||
|
#include "puttymem.h"
|
||||||
#define LOG(x)
|
#define LOG(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -220,7 +226,7 @@ static void *add234_internal(tree234 * t, void *e, int index)
|
|||||||
n->kids[2], n->counts[2], n->elems[2],
|
n->kids[2], n->counts[2], n->elems[2],
|
||||||
n->kids[3], n->counts[3]));
|
n->kids[3], n->counts[3]));
|
||||||
LOG((" need to insert %p/%d [%p] %p/%d at position %d\n",
|
LOG((" need to insert %p/%d [%p] %p/%d at position %d\n",
|
||||||
left, lcount, e, right, rcount, np - n->kids));
|
left, lcount, e, right, rcount, (int)(np - n->kids)));
|
||||||
if (n->elems[1] == NULL) {
|
if (n->elems[1] == NULL) {
|
||||||
/*
|
/*
|
||||||
* Insert in a 2-node; simple.
|
* Insert in a 2-node; simple.
|
||||||
@ -1469,7 +1475,8 @@ int main(void)
|
|||||||
printf("cleanup: tree size %d\n", count234(tree));
|
printf("cleanup: tree size %d\n", count234(tree));
|
||||||
j = randomnumber(&seed);
|
j = randomnumber(&seed);
|
||||||
j %= count234(tree);
|
j %= count234(tree);
|
||||||
printf("deleting string %s from index %d\n", array[j], j);
|
printf("deleting string %s from index %d\n",
|
||||||
|
(const char *)array[j], j);
|
||||||
delpostest(j);
|
delpostest(j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user