util: Mark port identity comparisons as const.

The utility function to compare port IDs takes pointers, but it only needs
to read the referenced data.  This patch marks the parameters as const,
allowing passing constants in the future.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2020-04-13 19:02:25 -07:00
parent 5aa19dd3f4
commit 44c06f5d44
1 changed files with 2 additions and 1 deletions

3
util.h
View File

@ -131,7 +131,8 @@ clockid_t posix_clock_open(const char *device, int *phc_index);
* @param b Second port identity.
* @return 1 if identities are equal, 0 otherwise.
*/
static inline int pid_eq(struct PortIdentity *a, struct PortIdentity *b)
static inline int pid_eq(const struct PortIdentity *a,
const struct PortIdentity *b)
{
return memcmp(a, b, sizeof(*a)) == 0;
}