The array_get() function returns success when an entry is retrieved that
was never set. This makes it hard to distinguish uninitialized entries.
This commit changes array_get() to return an error if the caller is
attempting to retrieve an uninitialized entry.
}
real_idx = idx % array->size;
- *data = array->data[real_idx];
+ if(!array->flags[real_idx]) {
+ return(-ENOENT);
+ }
+
+ *data = array->data[real_idx];
return(0);
}