Re: [PATCH 1/3] add strnncmp() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeremiah Mahler wrote:

> Add a strnncmp() function which behaves like strncmp() except it uses
> the length of both strings instead of just one.

The above description isn't very clear to me.  Problems:

 - strncmp compares prefixes of \0-terminated strings.  This function
   compares two binary buffers which can contain \0

 - strncmp is a comparison function and can even be used with functions
   like qsort (for operations like "sort on the first two characters").
   This function returns 0 or nonzero.

Would something like

  /* true if buffers have the same length and are byte-for-byte identical */
  int bufeq(const char *, int, const char *, int);

(or buf_equal, array_equal etc) make sense?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]