X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Funistr.h;h=83ff13411dc79071d89705571310d139b975522c;hb=e29e19dce9e19be76fae92b0955d02c843333093;hp=568a587bcacc762e17dc52f227af5ebf36a373b1;hpb=8c636b2cb76f0d462080b45c36158fbfa091320d;p=gnulib.git diff --git a/lib/unistr.h b/lib/unistr.h index 568a587bc..83ff13411 100644 --- a/lib/unistr.h +++ b/lib/unistr.h @@ -1,5 +1,5 @@ /* Elementary Unicode string functions. - Copyright (C) 2001-2002, 2005-2008 Free Software Foundation, Inc. + Copyright (C) 2001-2002, 2005-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -402,6 +402,15 @@ extern int extern int u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n); +/* Compare S1 and S2. */ +/* Similar to the gnulib function memcmp2(). */ +extern int + u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2); +extern int + u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2); +extern int + u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2); + /* Search the string at S for UC. */ /* Similar to memchr(). */ extern uint8_t * @@ -516,8 +525,8 @@ extern uint16_t * extern uint32_t * u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n); -/* Copy no more than N characters of SRC to DEST, returning the address of - the last character written into DEST. */ +/* Copy no more than N units of SRC to DEST, returning the address of + the last unit written into DEST. */ /* Similar to stpncpy(). */ extern uint8_t * u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n); @@ -553,6 +562,17 @@ extern int extern int u32_strcmp (const uint32_t *s1, const uint32_t *s2); +/* Compare S1 and S2 using the collation rules of the current locale. + Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2. + Upon failure, set errno and return any value. */ +/* Similar to strcoll(), wcscoll(). */ +extern int + u8_strcoll (const uint8_t *s1, const uint8_t *s2); +extern int + u16_strcoll (const uint16_t *s1, const uint16_t *s2); +extern int + u32_strcoll (const uint32_t *s1, const uint32_t *s2); + /* Compare no more than N units of S1 and S2. */ /* Similar to strncmp(), wcsncmp(). */ extern int