summaryrefslogtreecommitdiff
path: root/src/common/shibari_util_get_prefixlen.c
blob: 784a3ee6eed6425fc5ba532759587914320b1b9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <stdint.h>
#include <string.h>

#include <shibari/util.h>

int shibari_util_get_prefixlen (char const *name, uint16_t namelen, char const *zone, uint16_t zonelen)
{
  return
    namelen < zonelen ? -1 :
    memcmp(name + namelen - zonelen, zone, zonelen) ? -1 :
    namelen - zonelen ;
}