{
const unsigned char *fp = from;
static const char TABLE[] = "0123456789abcdef";
- while (fromlen) {
+ assert(from && fromlen>=0 && to);
+ while (fromlen--) {
*to++ = TABLE[*fp >> 4];
*to++ = TABLE[*fp & 7];
++fp;
void *smartlist_get(smartlist_t *sl, int idx)
{
+ assert(sl && idx>=0 && idx < sl->num_used);
return sl->list[idx];
}
void *smartlist_set(smartlist_t *sl, int idx, void *val)
{
void *old;
+ assert(sl && idx>=0 && idx < sl->num_used);
old = sl->list[idx];
sl->list[idx] = val;
return old;
void *smartlist_del(smartlist_t *sl, int idx)
{
void *old;
+ assert(sl && idx>=0 && idx < sl->num_used);
old = sl->list[idx];
sl->list[idx] = sl->list[--sl->num_used];
return old;