Skip to content

Commit

Permalink
Merge branch 'dev' into il_float_cmp_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pelijah authored Apr 23, 2024
2 parents 531292b + e08ceb9 commit 69009d0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions librz/include/rz_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ static inline void *rz_vector_head(const RzVector *vec) {
// returns a pointer to the last element of the vector
static inline void *rz_vector_tail(RzVector *vec) {
rz_return_val_if_fail(vec, NULL);
if (vec->len < 1) {
return NULL;
}
return (char *)vec->a + vec->elem_size * (vec->len - 1);
}

Expand Down Expand Up @@ -292,12 +295,18 @@ static inline void **rz_pvector_data(RzPVector *vec) {
// returns the first element of the vector
static inline void *rz_pvector_head(RzPVector *vec) {
rz_return_val_if_fail(vec, NULL);
if (vec->v.len < 1) {
return NULL;
}
return ((void **)vec->v.a)[0];
}

// returns the last element of the vector
static inline void *rz_pvector_tail(RzPVector *vec) {
rz_return_val_if_fail(vec, NULL);
if (vec->v.len < 1) {
return NULL;
}
return ((void **)vec->v.a)[vec->v.len - 1];
}

Expand Down

0 comments on commit 69009d0

Please sign in to comment.