Merge commit 'c8bf38e5fb' as 'dependencies/uthash'

This commit is contained in:
Toni Uhlig 2020-12-01 13:33:34 +01:00
commit 00e5132a80
250 changed files with 20767 additions and 0 deletions

44
dependencies/uthash/tests/test21.c vendored Normal file
View file

@ -0,0 +1,44 @@
#include <stdlib.h>
#include <stdio.h>
#include "uthash.h"
typedef struct {
char a;
int b;
} record_key_t;
typedef struct {
record_key_t key;
/* ... other data ... */
UT_hash_handle hh;
} record_t;
int main()
{
record_t l, *p, *r, *tmp, *records = NULL;
r = (record_t*)malloc( sizeof(record_t) );
if (r == NULL) {
exit(-1);
}
memset(r, 0, sizeof(record_t));
r->key.a = 'a';
r->key.b = 1;
HASH_ADD(hh, records, key, sizeof(record_key_t), r);
memset(&l, 0, sizeof(record_t));
l.key.a = 'a';
l.key.b = 1;
HASH_FIND(hh, records, &l.key, sizeof(record_key_t), p);
if (p != NULL) {
printf("found %c %d\n", p->key.a, p->key.b);
}
HASH_ITER(hh, records, p, tmp) {
HASH_DEL(records, p);
free(p);
}
return 0;
}