On 31 October 2013 05:46, Dodji Seketeli <do...@redhat.com> wrote: > +*/ > +static size_t > +string_length (const char* buf, size_t buf_size) > +{ > + for (int i = buf_size - 1; i > 0; --i) > + { > + if (buf[i] != 0) > + return i + 1; > + > + if (buf[i - 1] != 0) > + return i; > + } > + return 0; > +}
Why do you check both buf[i] and buf[i - 1] within the loop? Cheers, Manuel.