Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ptrlist: change return value of linearize_ptr_list()/ptr_list_to_array()
The function linearize_ptr_list() is annoying to use because it returns the number of elements put in the array. So, if you need to know if the list contained the expected number of entries, you need to allocate an array with one extra entry and check that the return value is one less than this size. So, change the function to return the total number of entries in the list. In other words, the return value corresponds now to the number of entries that could be copied if the size would be unlimited, much like it's done for snprintf(). The number of entries effectively copied stays, of course, limited by the size specified for the array. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
- Loading branch information