PostgreSQL Source Code: src/backend/utils/mb/wstrncmp.c File Reference (original) (raw)

Go to the source code of this file.

Functions
int pg_wchar_strncmp (const pg_wchar *s1, const pg_wchar *s2, size_t n)
int pg_char_and_wchar_strncmp (const char *s1, const pg_wchar *s2, size_t n)
size_t pg_wchar_strlen (const pg_wchar *str)

pg_char_and_wchar_strncmp()

int pg_char_and_wchar_strncmp ( const char * s1,
const pg_wchar * s2,
size_t n
)

Definition at line 55 of file wstrncmp.c.

56{

57 if (n == 0)

58 return 0;

59 do

60 {

61 if ((pg_wchar) ((unsigned char) *s1) != *s2++)

62 return ((pg_wchar) ((unsigned char) *s1) - *(s2 - 1));

63 if (*s1++ == 0)

64 break;

65 } while (--n != 0);

66 return 0;

67}

References s1, and s2.

Referenced by element(), and lookupcclass().

pg_wchar_strlen()

size_t pg_wchar_strlen ( const pg_wchar * str )

pg_wchar_strncmp()

Definition at line 40 of file wstrncmp.c.

41{

42 if (n == 0)

43 return 0;

44 do

45 {

46 if (*s1 != *s2++)

47 return (*s1 - *(s2 - 1));

48 if (*s1++ == 0)

49 break;

50 } while (--n != 0);

51 return 0;

52}

References s1, and s2.