Skip to content

armgit / xerj

Public Imported from GitHub
0

AI search engine and MCP server for bots and agents. One Rust binary indexes code, docs, logs, JSONL/CSV and PDFs for BM25 full-text, vector and hybrid search, code search without grep, agent memory and RAG. Elasticsearch-compatible API; Corpus Hub serves hundreds of reference memory corpora.

455 B
Raw Blame
#include "limits.h"
#include <string.h>

#define MINI_BUFFER_CAP 256

static char mini_buffer[MINI_BUFFER_CAP];

/* Copy at most MINI_BUFFER_CAP-1 bytes, always NUL-terminating. */
int mini_buffer_set(const char *src)
{
    size_t n = strlen(src);
    if (n >= MINI_BUFFER_CAP)
        n = MINI_BUFFER_CAP - 1;
    memcpy(mini_buffer, src, n);
    mini_buffer[n] = '\0';
    return (int)n;
}

const char *mini_buffer_get(void)
{
    return mini_buffer;
}