Beispiel #1
0
SEXP_t *probe_rcache_cstr_get(probe_rcache_t *cache, const char *k)
{
        SEXP_t *r = NULL;

        rbt_str_get(cache->tree, k, (void *)&r);

        return (r != NULL ? SEXP_ref(r) : NULL);
}
Beispiel #2
0
SEAP_err_t *SEAP_error_clone(SEAP_err_t *e)
{
	SEAP_err_t *n = SEAP_error_new();

	n->id   = e->id;
	n->code = e->code;
	n->type = e->type;
	n->data = e->data ? SEXP_ref(e->data) : NULL;

	return (n);
}
Beispiel #3
0
SEXP_t *probe_rcache_sexp_get(probe_rcache_t *cache, const SEXP_t * id)
{
        char    b[128], *k = b;
        SEXP_t *r = NULL;

        if (SEXP_string_cstr_r(id, k, sizeof b) == ((size_t)-1))
                k = SEXP_string_cstr(id);

        if (k == NULL)
                return(NULL);

        rbt_str_get(cache->tree, k, (void *)&r);

        if (k != b)
                free(k);

        return (r != NULL ? SEXP_ref(r) : NULL);
}
Beispiel #4
0
int probe_rcache_sexp_add(probe_rcache_t *cache, const SEXP_t *id, SEXP_t *item)
{
        SEXP_t *r;
        char   *k;

	assume_d(cache != NULL, -1);
	assume_d(id    != NULL, -1);
	assume_d(item  != NULL, -1);

        k = SEXP_string_cstr(id);
        r = SEXP_ref(item);

        if (rbt_str_add(cache->tree, k, (void *)r) != 0) {
                SEXP_free(r);
                free(k);
                return (-1);
        }

	return (0);
}