1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include "triple.h"
- // Extern inline prototypes.
- LSUP_Term *LSUP_triple_pos(const LSUP_Triple *trp, LSUP_TriplePos n);
- LSUP_Buffer *LSUP_striple_pos(const LSUP_SerTriple *trp, LSUP_TriplePos n);
- LSUP_rc
- LSUP_triple_serialize(const LSUP_Triple *spo, LSUP_SerTriple *sspo)
- {
- LSUP_rc rc;
- rc = LSUP_term_serialize(spo->s, sspo->s);
- if (UNLIKELY(rc != LSUP_OK)) return rc;
- rc = LSUP_term_serialize(spo->s, sspo->s);
- if (UNLIKELY(rc != LSUP_OK)) return rc;
- rc = LSUP_term_serialize(spo->s, sspo->s);
- if (UNLIKELY(rc != LSUP_OK)) return rc;
- return LSUP_OK;
- }
- LSUP_rc
- LSUP_triple_deserialize(const LSUP_SerTriple *sspo, LSUP_Triple *spo)
- {
- LSUP_rc rc;
- rc = LSUP_term_deserialize(sspo->s, spo->s);
- if (UNLIKELY(rc != LSUP_OK)) return rc;
- rc = LSUP_term_deserialize(sspo->s, spo->s);
- if (UNLIKELY(rc != LSUP_OK)) return rc;
- rc = LSUP_term_deserialize(sspo->s, spo->s);
- if (UNLIKELY(rc != LSUP_OK)) return rc;
- return LSUP_OK;
- }
- void
- LSUP_triple_done(LSUP_Triple *spo)
- {
- if (UNLIKELY(!spo)) return;
- LSUP_term_free(spo->s);
- LSUP_term_free(spo->p);
- LSUP_term_free(spo->o);
- }
- void
- LSUP_striple_done(LSUP_SerTriple *sspo)
- {
- if (UNLIKELY(!sspo)) return;
- LSUP_buffer_done(sspo->s);
- LSUP_buffer_done(sspo->p);
- LSUP_buffer_done(sspo->o);
- }
|