include/prism/util/pm_constant_pool.h in prism-0.24.0 vs include/prism/util/pm_constant_pool.h in prism-0.25.0

- old
+ new

@@ -50,20 +50,37 @@ * @param list The list to initialize. */ void pm_constant_id_list_init(pm_constant_id_list_t *list); /** + * Initialize a list of constant ids with a given capacity. + * + * @param list The list to initialize. + * @param capacity The initial capacity of the list. + */ +void pm_constant_id_list_init_capacity(pm_constant_id_list_t *list, size_t capacity); + +/** * Append a constant id to a list of constant ids. Returns false if any * potential reallocations fail. * * @param list The list to append to. * @param id The id to append. * @return Whether the append succeeded. */ bool pm_constant_id_list_append(pm_constant_id_list_t *list, pm_constant_id_t id); /** + * Insert a constant id into a list of constant ids at the specified index. + * + * @param list The list to insert into. + * @param index The index at which to insert. + * @param id The id to insert. + */ +void pm_constant_id_list_insert(pm_constant_id_list_t *list, size_t index, pm_constant_id_t id); + +/** * Checks if the current constant id list includes the given constant id. * * @param list The list to check. * @param id The id to check for. * @return Whether the list includes the given id. @@ -184,10 +201,10 @@ * @param pool The pool to insert the constant into. * @param start A pointer to the start of the constant. * @param length The length of the constant. * @return The id of the constant. */ -pm_constant_id_t pm_constant_pool_insert_owned(pm_constant_pool_t *pool, const uint8_t *start, size_t length); +pm_constant_id_t pm_constant_pool_insert_owned(pm_constant_pool_t *pool, uint8_t *start, size_t length); /** * Insert a constant into a constant pool from memory that is constant. Returns * the id of the constant, or 0 if any potential calls to resize fail. *