mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-12-04 04:37:20 +08:00
Complete C implementation of the indexing pipeline (src/), parallel worker pool, graph buffer with merge support, SQLite writer, and 1893-test suite. Linter setup: zero warnings from clang-tidy (all checks enabled, no NOLINT suppressions), cppcheck, and clang-format. All issues fixed at source — proper headers for external linkage, GROW_ARRAY macro restructured to eliminate type parameter, null-deref paths guarded, named intermediates for suspicious-argument checks.
37 lines
1.1 KiB
C
37 lines
1.1 KiB
C
/*
|
|
* str_intern.h — String interning pool.
|
|
*
|
|
* Deduplicates strings: identical strings share a single allocation.
|
|
* Returns stable pointers — safe to compare by pointer equality after interning.
|
|
*
|
|
* Uses an arena for string storage (bulk free) + hash table for dedup lookup.
|
|
*/
|
|
#ifndef CBM_STR_INTERN_H
|
|
#define CBM_STR_INTERN_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
typedef struct CBMInternPool CBMInternPool;
|
|
|
|
/* Create a new intern pool. */
|
|
CBMInternPool *cbm_intern_create(void);
|
|
|
|
/* Free the pool and all interned strings. */
|
|
void cbm_intern_free(CBMInternPool *pool);
|
|
|
|
/* Intern a NUL-terminated string. Returns a stable pointer.
|
|
* The same input always returns the same pointer. */
|
|
const char *cbm_intern(CBMInternPool *pool, const char *s);
|
|
|
|
/* Intern a string of known length. */
|
|
const char *cbm_intern_n(CBMInternPool *pool, const char *s, size_t len);
|
|
|
|
/* Number of unique strings in the pool. */
|
|
uint32_t cbm_intern_count(const CBMInternPool *pool);
|
|
|
|
/* Total bytes stored (unique strings only). */
|
|
size_t cbm_intern_bytes(const CBMInternPool *pool);
|
|
|
|
#endif /* CBM_STR_INTERN_H */
|