|
|
|
@ -692,6 +692,22 @@ int sxtrdb_setlength(sxtrdb_t *b, uint32_t s)
|
|
|
|
|
return SXT_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* compare buffers, returns 0 if equal */
|
|
|
|
|
int sxtrdb_cmp(sxtrdb_t *b1, sxtrdb_t *b2)
|
|
|
|
|
{
|
|
|
|
|
int c = 0;
|
|
|
|
|
|
|
|
|
|
if(!b1 | !b2) return -1;
|
|
|
|
|
|
|
|
|
|
if((c = sxtrdb_length(b1) - sxtrdb_length(b2)) != 0) return c;
|
|
|
|
|
else c = memcmp((const void *)sxtrdb_rdata(b1),
|
|
|
|
|
(const void *)sxtrdb_rdata(b2),
|
|
|
|
|
sxtrdb_length(b1));
|
|
|
|
|
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* let the buffer to use actually used bytes, not all allocated space
|
|
|
|
|
* will return SXT_SUCCESS on success (or in case if it doesn't required),
|
|
|
|
|
* SXT_ENOMEM or other error if fails
|
|
|
|
|