This is really an oversight on my part.
The append should by default append a single item.
To append an entire set, a new function should be used (an append all function).
This should be done for all of the string types that are applicable.
Such changes are left for the next release and are not planed for the 0.5.8 release.
This functionality is necessary for bug fixes in the controller program.
#endif // !defined(_di_f_string_map_multis_adjust_) || !defined(_di_f_string_map_multis_decimate_by_)
#if !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
- f_status_t private_f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t * const destination) {
+ f_status_t private_f_string_map_multis_append(const f_string_map_multi_t source, f_string_map_multis_t * const destination) {
+
+ f_status_t status = F_none;
+
+ if (destination->used + 1 > destination->size) {
+ status = private_f_string_map_multis_resize(destination->used + F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ destination->array[destination->used].name.used = 0;
+ destination->array[destination->used].value.used = 0;
+
+ if (source.name.used) {
+ status = private_f_string_append(source.name.string, source.name.used, &destination->array[destination->used].name);
+ if (F_status_is_error(status)) return status;
+ }
+
+ if (source.value.used) {
+ status = private_f_string_dynamics_append(source.value, &destination->array[destination->used].value);
+ if (F_status_is_error(status)) return status;
+ }
+
+ ++destination->used;
+
+ return F_none;
+ }
+#endif // !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
+
+#if !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
+ f_status_t private_f_string_map_multis_append_all(const f_string_map_multis_t source, f_string_map_multis_t * const destination) {
f_status_t status = F_none;
return F_none;
}
-#endif // !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
+#endif // !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
#if !defined(_di_f_string_map_multis_decrease_by_) || !defined(_di_f_string_map_multis_increase_) || !defined(_di_f_string_map_multis_increase_by_) || !defined(_di_f_string_map_multis_terminate_) || !defined(_di_f_string_map_multis_terminate_after_)
f_status_t private_f_string_map_multis_resize(const f_array_length_t length, f_string_map_multis_t * const map_multis) {
#endif // !defined(_di_f_string_maps_adjust_) || !defined(_di_f_string_maps_decimate_by_)
#if !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
- f_status_t private_f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination) {
+ f_status_t private_f_string_maps_append(const f_string_map_t source, f_string_maps_t * const destination) {
+
+ f_status_t status = F_none;
+
+ if (destination->used + 1 > destination->size) {
+ status = private_f_string_maps_resize(destination->used + F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ destination->array[destination->used].name.used = 0;
+ destination->array[destination->used].value.used = 0;
+
+ if (source.name.used) {
+ status = private_f_string_append(source.name.string, source.name.used, &destination->array[destination->used].name);
+ if (F_status_is_error(status)) return status;
+ }
+
+ if (source.value.used) {
+ status = private_f_string_append(source.value.string, source.value.used, &destination->array[destination->used].value);
+ if (F_status_is_error(status)) return status;
+ }
+
+ ++destination->used;
+
+ return F_none;
+ }
+#endif // !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
+
+#if !defined(_di_f_string_mapss_append_all_) || !defined(_di_f_string_maps_append_all_)
+ f_status_t private_f_string_maps_append_all(const f_string_maps_t source, f_string_maps_t * const destination) {
f_status_t status = F_none;
return F_none;
}
-#endif // !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
+#endif // !defined(_di_f_string_mapss_append_all_) || !defined(_di_f_string_maps_append_all_)
#if !defined(_di_f_string_maps_decrease_by_) || !defined(_di_f_string_maps_increase_) || !defined(_di_f_string_maps_increase_by_) || !defined(_di_f_string_maps_terminate_) || !defined(_di_f_string_maps_terminate_after_)
f_status_t private_f_string_maps_resize(const f_array_length_t length, f_string_maps_t * const maps) {
* Intended to be shared to each of the different implementation variations.
*
* @param source
- * The source strings to append.
+ * The source multi-map to append.
* @param destination
- * The destination strings the source is appended onto.
+ * The destination multi-maps the source is appended onto.
*
* @return
* F_none on success.
* @see f_string_map_multiss_append()
*/
#if !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
- extern f_status_t private_f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t * const destination) F_attribute_visibility_internal_d;
+ extern f_status_t private_f_string_map_multis_append(const f_string_map_multi_t source, f_string_map_multis_t * const destination) F_attribute_visibility_internal_d;
#endif // !defined(_di_f_string_map_multiss_append_) || !defined(_di_f_string_map_multis_append_)
/**
+ * Private implementation for appending.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param source
+ * The source multi-maps to append.
+ * @param destination
+ * The destination multi-maps the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ * Errors (with error bit) from: f_string_map_multis_append().
+ * Errors (with error bit) from: f_string_map_multiss_append().
+ *
+ * @see f_memory_resize()
+ * @see f_string_map_multis_append()
+ * @see f_string_map_multiss_append()
+ */
+#if !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
+ extern f_status_t private_f_string_map_multis_append_all(const f_string_map_multis_t source, f_string_map_multis_t * const destination) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_map_multiss_append_all_) || !defined(_di_f_string_map_multis_append_all_)
+
+/**
* Private implementation for resizing.
*
* Intended to be shared to each of the different implementation variations.
* Intended to be shared to each of the different implementation variations.
*
* @param source
- * The source strings to append.
+ * The source map to append.
* @param destination
- * The destination strings the source is appended onto.
+ * The destination maps the source is appended onto.
*
* @return
* F_none on success.
* @see f_string_mapss_append()
*/
#if !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
- extern f_status_t private_f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination) F_attribute_visibility_internal_d;
+ extern f_status_t private_f_string_maps_append(const f_string_map_t source, f_string_maps_t * const destination) F_attribute_visibility_internal_d;
#endif // !defined(_di_f_string_mapss_append_) || !defined(_di_f_string_maps_append_)
/**
+ * Private implementation for appending.
+ *
+ * Intended to be shared to each of the different implementation variations.
+ *
+ * @param source
+ * The source maps to append.
+ * @param destination
+ * The destination maps the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ *
+ * F_array_too_large (with error bit) if the combined array is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ *
+ * @see f_memory_resize()
+ * @see f_string_maps_append()
+ * @see f_string_mapss_append()
+ */
+#if !defined(_di_f_string_mapss_append_all_) || !defined(_di_f_string_maps_append_all_)
+ extern f_status_t private_f_string_maps_append_all(const f_string_maps_t source, f_string_maps_t * const destination) F_attribute_visibility_internal_d;
+#endif // !defined(_di_f_string_mapss_append_all_) || !defined(_di_f_string_maps_append_all_)
+
+/**
* Private implementation for resizing.
*
* Intended to be shared to each of the different implementation variations.
#endif // _di_f_string_map_multis_adjust_
#ifndef _di_f_string_map_multis_append_
- f_status_t f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t * const destination) {
+ f_status_t f_string_map_multis_append(const f_string_map_multi_t source, f_string_map_multis_t * const destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_status_t status = F_none;
+
+ if (destination->used + 1 > destination->size) {
+ status = private_f_string_map_multis_resize(destination->used + F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ destination->array[destination->used].name.used = 0;
+ destination->array[destination->used].value.used = 0;
+
+ if (source.name.used) {
+ status = private_f_string_append(source.name.string, source.name.used, &destination->array[destination->used].name);
+ if (F_status_is_error(status)) return status;
+ }
+
+ if (source.value.used) {
+ status = private_f_string_dynamics_append(source.value, &destination->array[destination->used].value);
+ if (F_status_is_error(status)) return status;
+ }
+
+ ++destination->used;
+
+ return F_none;
+ }
+#endif // _di_f_string_map_multis_append_
+
+#ifndef _di_f_string_map_multis_append_all_
+ f_status_t f_string_map_multis_append_all(const f_string_map_multis_t source, f_string_map_multis_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
return F_none;
}
-#endif // _di_f_string_map_multis_append_
+#endif // _di_f_string_map_multis_append_all_
#ifndef _di_f_string_map_multis_decimate_by_
f_status_t f_string_map_multis_decimate_by(const f_array_length_t amount, f_string_map_multis_t * const map_multis) {
#endif // _di_f_string_map_multiss_adjust_
#ifndef _di_f_string_map_multiss_append_
- f_status_t f_string_map_multiss_append(const f_string_map_multiss_t source, f_string_map_multiss_t * const destination) {
+ f_status_t f_string_map_multiss_append(const f_string_map_multis_t source, f_string_map_multiss_t * const destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ f_status_t status = F_none;
+
+ if (destination->used + 1 > destination->size) {
+ status = private_f_string_map_multiss_resize(destination->used + F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ destination->array[destination->used].used = 0;
+
+ if (source.used) {
+ status = private_f_string_map_multis_append_all(source, &destination->array[destination->used]);
+ if (F_status_is_error(status)) return status;
+ }
+
+ ++destination->used;
+
+ return F_none;
+ }
+#endif // _di_f_string_map_multiss_append_
+
+#ifndef _di_f_string_map_multiss_append_all_
+ f_status_t f_string_map_multiss_append_all(const f_string_map_multiss_t source, f_string_map_multiss_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
destination->array[destination->used].used = 0;
if (source.array[i].used) {
- status = private_f_string_map_multis_append(source.array[i], &destination->array[destination->used]);
+ status = private_f_string_map_multis_append_all(source.array[i], &destination->array[destination->used]);
if (F_status_is_error(status)) return status;
}
} // for
return F_none;
}
-#endif // _di_f_string_map_multiss_append_
+#endif // _di_f_string_map_multiss_append_all_
#ifndef _di_f_string_map_multiss_decimate_by_
f_status_t f_string_map_multiss_decimate_by(const f_array_length_t amount, f_string_map_multiss_t * const map_multiss) {
#endif // _di_f_string_maps_adjust_
#ifndef _di_f_string_maps_append_
- f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination) {
+ f_status_t f_string_maps_append(const f_string_map_t source, f_string_maps_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
- if (!source.used) return F_data_not;
-
return private_f_string_maps_append(source, destination);
}
#endif // _di_f_string_maps_append_
+#ifndef _di_f_string_maps_append_all_
+ f_status_t f_string_maps_append_all(const f_string_maps_t source, f_string_maps_t * const destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!source.used) return F_data_not;
+
+ return private_f_string_maps_append_all(source, destination);
+ }
+#endif // _di_f_string_maps_append_all_
+
#ifndef _di_f_string_maps_decimate_by_
f_status_t f_string_maps_decimate_by(const f_array_length_t amount, f_string_maps_t * const maps) {
#ifndef _di_level_0_parameter_checking_
#endif // _di_f_string_mapss_adjust_
#ifndef _di_f_string_mapss_append_
- f_status_t f_string_mapss_append(const f_string_mapss_t source, f_string_mapss_t * const destination) {
+ f_status_t f_string_mapss_append(const f_string_maps_t source, f_string_mapss_t * const destination) {
+ #ifndef _di_level_0_parameter_checking_
+ if (!destination) return F_status_set_error(F_parameter);
+ #endif // _di_level_0_parameter_checking_
+
+ if (!source.used) return F_data_not;
+
+ f_status_t status = F_none;
+
+ if (destination->used + 1 > destination->size) {
+ status = private_f_string_mapss_resize(destination->used + F_memory_default_allocation_small_d, destination);
+ if (F_status_is_error(status)) return status;
+ }
+
+ destination->array[destination->used].used = 0;
+
+ if (source.used) {
+ status = private_f_string_maps_append_all(source, &destination->array[destination->used]);
+ if (F_status_is_error(status)) return status;
+ }
+
+ ++destination->used;
+
+ return F_none;
+ }
+#endif // _di_f_string_mapss_append_
+
+#ifndef _di_f_string_mapss_append_all_
+ f_status_t f_string_mapss_append_all(const f_string_mapss_t source, f_string_mapss_t * const destination) {
#ifndef _di_level_0_parameter_checking_
if (!destination) return F_status_set_error(F_parameter);
#endif // _di_level_0_parameter_checking_
destination->array[destination->used].used = 0;
if (source.array[i].used) {
- status = private_f_string_maps_append(source.array[i], &destination->array[destination->used]);
+ status = private_f_string_maps_append_all(source.array[i], &destination->array[destination->used]);
if (F_status_is_error(status)) return status;
}
} // for
return F_none;
}
-#endif // _di_f_string_mapss_append_
+#endif // _di_f_string_mapss_append_all_
#ifndef _di_f_string_mapss_decimate_by_
f_status_t f_string_mapss_decimate_by(const f_array_length_t amount, f_string_mapss_t * const mapss) {
#endif // _di_f_string_map_multis_adjust_
/**
- * Append the source map_multis onto the destination.
+ * Append a single source map_multi onto the destination.
*
* @param source
* The source maps to append.
*
* @return
* F_none on success.
- * F_data_not on success, but there is nothing to append (size == 0).
*
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if the combined string is too large.
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_map_multis_append_
- f_status_t f_string_map_multis_append(const f_string_map_multis_t source, f_string_map_multis_t *destination);
+ f_status_t f_string_map_multis_append(const f_string_map_multi_t source, f_string_map_multis_t *destination);
#endif // _di_f_string_map_multis_append_
/**
+ * Append the source map_multis onto the destination.
+ *
+ * @param source
+ * The source maps to append.
+ * @param destination
+ * The destination maps the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is nothing to append (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_string_too_large (with error bit) if the combined string is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_map_multis_append_all_
+ f_status_t f_string_map_multis_append_all(const f_string_map_multis_t source, f_string_map_multis_t *destination);
+#endif // _di_f_string_map_multis_append_all_
+
+/**
* Resize the map_multis array to a smaller size.
*
* This will resize making the array smaller based on (size - given length).
#endif // _di_f_string_maps_adjust_
/**
- * Append the source maps onto the destination.
+ * Append a single source map onto the destination.
*
* @param source
* The source maps to append.
*
* @return
* F_none on success.
- * F_data_not on success, but there is nothing to append (size == 0).
*
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if the combined string is too large.
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_maps_append_
- extern f_status_t f_string_maps_append(const f_string_maps_t source, f_string_maps_t * const destination);
+ extern f_status_t f_string_maps_append(const f_string_map_t source, f_string_maps_t * const destination);
#endif // _di_f_string_maps_append_
/**
+ * Append the source maps onto the destination.
+ *
+ * @param source
+ * The source maps to append.
+ * @param destination
+ * The destination maps the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is nothing to append (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_string_too_large (with error bit) if the combined string is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_maps_append_all_
+ extern f_status_t f_string_maps_append_all(const f_string_maps_t source, f_string_maps_t * const destination);
+#endif // _di_f_string_maps_append_all_
+
+/**
* Resize the string maps array to a smaller size.
*
* This will resize making the array smaller based on (size - given length).
#endif // _di_f_string_mapss_adjust_
/**
- * Append the source mapss onto the destination.
+ * Append a single source maps onto the destination.
*
* @param source
* The source mapss to append.
*
* @return
* F_none on success.
- * F_data_not on success, but there is nothing to append (size == 0).
*
* F_parameter (with error bit) if a parameter is invalid.
* F_string_too_large (with error bit) if the combined string is too large.
* Errors (with error bit) from: f_memory_resize().
*/
#ifndef _di_f_string_mapss_append_
- extern f_status_t f_string_mapss_append(const f_string_mapss_t source, f_string_mapss_t * const destination);
+ extern f_status_t f_string_mapss_append(const f_string_maps_t source, f_string_mapss_t * const destination);
#endif // _di_f_string_mapss_append_
/**
+ * Append the source mapss onto the destination.
+ *
+ * @param source
+ * The source mapss to append.
+ * @param destination
+ * The destination mapss the source is appended onto.
+ *
+ * @return
+ * F_none on success.
+ * F_data_not on success, but there is nothing to append (size == 0).
+ *
+ * F_parameter (with error bit) if a parameter is invalid.
+ * F_string_too_large (with error bit) if the combined string is too large.
+ *
+ * Errors (with error bit) from: f_memory_resize().
+ */
+#ifndef _di_f_string_mapss_append_all_
+ extern f_status_t f_string_mapss_append_all(const f_string_mapss_t source, f_string_mapss_t * const destination);
+#endif // _di_f_string_mapss_append_all_
+
+/**
* Resize the string mapss array to a smaller size.
*
* This will resize making the array smaller based on (size - given length).