This commit refactors the project using a single, consistent coding style, derived from the Linux Kernel Coding Style, available here: https://www.kernel.org/doc/Documentation/CodingStyle This includes, but is not limited to: * Removal of typedefs, especially for structs * Limiting lines to a reasonable length, 80 characters, mostly * K&R style braces * Removal of CamelCase
29 lines
684 B
C
29 lines
684 B
C
#ifndef TVM_HTAB_H_
|
|
#define TVM_HTAB_H_
|
|
|
|
#define KEY_LENGTH 64
|
|
#define HTAB_SIZE 4096
|
|
|
|
struct tvm_htab_node {
|
|
char *key;
|
|
int value;
|
|
void *valptr;
|
|
struct tvm_htab_node *next;
|
|
};
|
|
|
|
struct tvm_htab_ctx {
|
|
unsigned int num_nodes;
|
|
unsigned int size;
|
|
struct tvm_htab_node **nodes;
|
|
};
|
|
|
|
struct tvm_htab_ctx *tvm_htab_create();
|
|
void tvm_htab_destroy(struct tvm_htab_ctx *htab);
|
|
|
|
int tvm_htab_add(struct tvm_htab_ctx *htab, const char *key, int value);
|
|
int tvm_htab_add_ref(struct tvm_htab_ctx *htab,
|
|
const char *key, const void *valptr, int len);
|
|
int tvm_htab_find(struct tvm_htab_ctx *htab, const char *key);
|
|
char *tvm_htab_find_ref(struct tvm_htab_ctx *htab, const char *key);
|
|
|
|
#endif
|