MINOR: ist: add istissame() function

The istissame() function takes 2 ist and compare their <.ptr> and <.len>
values respectively. It returns non-zero if they are the same.
This commit is contained in:
Baptiste Assmann 2020-03-29 09:10:27 +02:00 committed by Willy Tarreau
parent 9ef1967af7
commit de80201460
1 changed files with 8 additions and 0 deletions

View File

@ -751,6 +751,14 @@ static inline struct ist istadv(const struct ist ist, const size_t nb)
return ist2(ist.ptr + nb, ist.len - nb); return ist2(ist.ptr + nb, ist.len - nb);
} }
/*
* compare 2 ists and return non-zero if they are the same
*/
static inline int istissame(const struct ist ist1, const struct ist ist2)
{
return ((ist1.ptr == ist2.ptr) && (ist1.len == ist2.len));
}
#ifndef IST_FREESTANDING #ifndef IST_FREESTANDING
/* This function allocates <size> bytes and returns an `ist` pointing to /* This function allocates <size> bytes and returns an `ist` pointing to
* the allocated area with size `0`. * the allocated area with size `0`.