#include "hostent.ih"

// static
size_t Hostent::countAddresses(char const * const *addresses, size_t length)
{
    PTR  ptr = {addresses};
    size_t nAddr = 1;                 // counts the final 0-address

    while (
        static_cast<size_t>(
            count(ptr.p1, ptr.p1 + length, char{})
        ) != length
    )
    {
        ptr.p1 += length;
        ++nAddr;
    }
    return nAddr;
}
