Index: src/backend/utils/adt/like.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/like.c,v
retrieving revision 1.59
diff -c -c -r1.59 like.c
*** src/backend/utils/adt/like.c	31 Dec 2004 22:01:22 -0000	1.59
--- src/backend/utils/adt/like.c	25 May 2005 22:24:46 -0000
***************
*** 50,61 ****
  static int
  wchareq(unsigned char *p1, unsigned char *p2)
  {
! 	int			l;
  
! 	l = pg_mblen(p1);
! 	if (pg_mblen(p2) != l)
  		return (0);
! 	while (l--)
  	{
  		if (*p1++ != *p2++)
  			return (0);
--- 50,67 ----
  static int
  wchareq(unsigned char *p1, unsigned char *p2)
  {
! 	int			p1_len;
  
! 	/* Optimization:  quickly compare the first byte. */
! 	if(*p1 != *p2)
  		return (0);
! 
! 	p1_len = pg_mblen(p1);
! 	if (pg_mblen(p2) != p1_len)
! 		return (0);
! 
! 	/* They are the same length */
! 	while (p1_len--)
  	{
  		if (*p1++ != *p2++)
  			return (0);
