You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First off, thanks for the comments! I really appreciate you taking a look. This dict implementation is taken straight from Redis, so it might be better to raise questions upstream. I'm open to fixing obvious things, though.
Just trying to learn C by reading others' code. And lately I was trying to
understand how web server works, and your code seems to be pretty easy to
follow. However, I found a couple of things two hard to understand. I would
need help to get through them
First off, thanks for the comments! I really appreciate you taking a look.
This dict implementation is taken straight from Redis, so it might be
better to raise questions upstream. I'm open to fixing obvious things,
though.
Reply to this email directly or view it on GitHubhttps://github.com//issues/18#issuecomment-35223997
.
dictIterator _dictGetIterator(dict *d)
{
dictIterator *iter = malloc(sizeof(_iter));
}
No check to see if malloc actually creates heap object.
dictEntry *dictNext(dictIterator *iter)
{
while (1) {
if (iter->entry == NULL) {
dictht *ht = &iter->d->ht[iter->table];
if (iter->safe && iter->index == -1 && iter->table == 0)
iter->d->iterators++;
iter->index++;
if (iter->index >= (signed) ht->size) {
if (dictIsRehashing(iter->d) && iter->table == 0) {
iter->table++;
iter->index = 0;
ht = &iter->d->ht[1];
} else {
break;
}
Looks like this code would break someday because of inconsistency,&iter->d->ht[iter->table] and &iter->d->ht[1]
The text was updated successfully, but these errors were encountered: