@@ -69,27 +69,24 @@ bool bin_pack_obj(bin_pack_cb *callback, const Logger *logger, const void *obj,
6969
7070/** @brief Determine the serialised size of an object array.
7171 *
72- * Calls the callback `count` times with increasing `index` argument from 0 to
73- * `count`. This function is here just so we don't need to write the same
74- * trivial loop many times and so we don't need an extra struct just to contain
75- * an array with size so it can be passed to `bin_pack_obj_size`.
72+ * Behaves exactly like `bin_pack_obj_b_array` but doesn't write.
7673 *
7774 * @param callback The function called on the created packer and each object to
7875 * be packed.
7976 * @param logger Optional logger object to pass to the callback.
8077 * @param arr The object array to be packed, passed as `arr` to the callback.
81- * @param count The number of elements in the object array.
78+ * @param arr_size The number of elements in the object array.
8279 *
8380 * @return The packed size of the passed object array according to the callback.
8481 * @retval UINT32_MAX in case of errors such as buffer overflow.
8582 */
8683non_null (1 , 3 ) nullable (2 )
87- uint32_t bin_pack_obj_array_size (bin_pack_array_cb * callback , const Logger * logger , const void * arr , uint32_t count );
84+ uint32_t bin_pack_obj_array_b_size (bin_pack_array_cb * callback , const Logger * logger , const void * arr , uint32_t arr_size );
8885
8986/** @brief Pack an object array into a buffer of a given size.
9087 *
91- * Calls the callback `count ` times with increasing `index` argument from 0 to
92- * `count `. This function is here just so we don't need to write the same
88+ * Calls the callback `arr_size ` times with increasing `index` argument from 0 to
89+ * `arr_size `. This function is here just so we don't need to write the same
9390 * trivial loop many times and so we don't need an extra struct just to contain
9491 * an array with size so it can be passed to `bin_pack_obj`.
9592 *
@@ -100,33 +97,14 @@ uint32_t bin_pack_obj_array_size(bin_pack_array_cb *callback, const Logger *logg
10097 * array.
10198 * @param logger Optional logger object to pass to the callback.
10299 * @param arr The object array to be packed, passed as `arr` to the callback.
103- * @param count The number of elements in the object array.
100+ * @param arr_size The number of elements in the object array.
104101 * @param buf A byte array large enough to hold the serialised representation of `arr`.
105102 * @param buf_size The size of the byte array. Can be `UINT32_MAX` to disable bounds checking.
106103 *
107104 * @retval false if an error occurred (e.g. buffer overflow).
108105 */
109106non_null (1 , 3 , 5 ) nullable (2 )
110- bool bin_pack_obj_array (bin_pack_array_cb * callback , const Logger * logger , const void * arr , uint32_t count , uint8_t * buf , uint32_t buf_size );
111-
112- /** @brief Allocate a new packer object.
113- *
114- * This is the only function that allocates memory in this module.
115- *
116- * @param buf A byte array large enough to hold the serialised representation of `obj`.
117- * @param buf_size The size of the byte array. Can be `UINT32_MAX` to disable bounds checking.
118- *
119- * @retval nullptr on allocation failure.
120- */
121- non_null ()
122- Bin_Pack * bin_pack_new (uint8_t * buf , uint32_t buf_size );
123-
124- /** @brief Deallocates a packer object.
125- *
126- * Does not deallocate the buffer inside.
127- */
128- nullable (1 )
129- void bin_pack_free (Bin_Pack * bp );
107+ bool bin_pack_obj_array_b (bin_pack_array_cb * callback , const Logger * logger , const void * arr , uint32_t arr_size , uint8_t * buf , uint32_t buf_size );
130108
131109/** @brief Start packing a MessagePack array.
132110 *
0 commit comments