util: Use util_is_power_of_two_nonzero in u_vector
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 26 Mar 2018 17:52:43 +0000 (10:52 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 29 Mar 2018 21:09:28 +0000 (14:09 -0700)
Previously size=0, element_size=0 would have been allowed.  That
combination can only lead to despair.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
src/util/u_vector.c

index bec6e5bbc30a97584f1b2dc84f3f9a7c305cfc4c..15f8ed6bdad43802220debf6582878db4516fdc1 100644 (file)
@@ -37,8 +37,8 @@
 int
 u_vector_init(struct u_vector *vector, uint32_t element_size, uint32_t size)
 {
-   assert(util_is_power_of_two_or_zero(size));
-   assert(element_size < size && util_is_power_of_two_or_zero(element_size));
+   assert(util_is_power_of_two_nonzero(size));
+   assert(element_size < size && util_is_power_of_two_nonzero(element_size));
 
    vector->head = 0;
    vector->tail = 0;