35 #include "ha0storage.ic"
45 ha_storage_t* storage,
49 ha_storage_node_t* node;
57 node->data_len == data_len && memcmp(node->data, data, data_len) == 0
90 ha_storage_t* storage,
96 ha_storage_node_t* node;
97 const void* data_copy;
101 data_copy = ha_storage_get(storage, data, data_len);
102 if (data_copy != NULL) {
119 sizeof(ha_storage_node_t) + data_len);
121 node = (ha_storage_node_t*) raw;
122 data_copy = (byte*) raw +
sizeof(*node);
124 memcpy((byte*) raw +
sizeof(*node), data, data_len);
126 node->data_len = data_len;
127 node->data = data_copy;
145 #ifdef UNIV_COMPILE_TEST_FUNCS
150 ha_storage_t* storage;
153 const void* stored[256];
158 for (i = 0; i < 256; i++) {
160 memset(buf, i,
sizeof(buf));
166 for (i = 255; i >= 0; i--) {
168 memset(buf, i,
sizeof(buf));
171 if (p != stored[i]) {
173 fprintf(stderr,
"ha_storage_put() returned %p "
174 "instead of %p, i=%d\n", p, stored[i], i);
179 fprintf(stderr,
"all ok\n");