Open chrisjbreisch opened 1 year ago
It's not quite a bug but could be better. This section of code:
if (entry->key == NULL) return false; *value = entry->value; return true;
I think a better implementation would be:
*value = entry->value; return entry->key != NULL;
Yes, I can always check the return value from tableGet, but setting *value regardless of the return value is safer. User will get a NIL_VAL back if the entry isn't found, rather than what they sent in.
It's not quite a bug but could be better. This section of code:
I think a better implementation would be:
Yes, I can always check the return value from tableGet, but setting *value regardless of the return value is safer. User will get a NIL_VAL back if the entry isn't found, rather than what they sent in.