+ *list = NULL;
+}
+
+bool u_arraylist_reserve(u_arraylist_t *list, size_t count)
+{
+ if (list && (count > list->capacity))
+ {
+ void *tmp = OICRealloc(list->data, count * sizeof(list->data[0]));
+ if (!tmp)
+ {
+ OIC_LOG(DEBUG, TAG, "Memory reallocation failed.");
+ return false;
+ }
+ else
+ {
+ list->data = (void **) tmp;
+ list->capacity = count;
+ }
+ }
+ return true;
+}
+
+void u_arraylist_shrink_to_fit(u_arraylist_t *list)
+{
+ if (!list)
+ {
+ return;
+ }
+
+ if ((list->capacity > list->length)
+ && (list->length >= U_ARRAYLIST_DEFAULT_CAPACITY))
+ {
+ void *tmp = OICRealloc(list->data,
+ list->length * sizeof(list->data[0]));
+ if (!tmp)
+ {
+ OIC_LOG(DEBUG, TAG, "Memory reallocation failed.");
+ // Considered non-fatal as this call is non-binding.
+ }
+ else
+ {
+ list->data = (void **) tmp;
+ list->capacity = list->length;
+ }
+ }