]> granicus.if.org Git - postgresql/blobdiff - src/backend/utils/adt/like_match.c
Message style improvements
[postgresql] / src / backend / utils / adt / like_match.c
index 9236922da7489087a442749b877b107ba6248df1..144f408b98a313d2b8b2e1f8222089fbc38617a4 100644 (file)
  * MatchTextIC (MBMatchTextIC)
  * do_like_escape (MB_do_like_escape)
  *
- * Copyright (c) 1996-2003, PostgreSQL Global Development Group
+ * Copyright (c) 1996-2006, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *     $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.8 2003/11/29 19:51:58 pgsql Exp $
+ *     $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.13 2006/03/05 15:58:42 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -71,7 +71,7 @@
  */
 
 static int
-MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
+MatchText(char *t, int tlen, char *p, int plen)
 {
        /* Fast path for match-everything pattern */
        if ((plen == 1) && (*p == '%'))
@@ -97,8 +97,8 @@ MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
                                return LIKE_TRUE;
 
                        /*
-                        * Otherwise, scan for a text position at which we can match
-                        * the rest of the pattern.
+                        * Otherwise, scan for a text position at which we can match the
+                        * rest of the pattern.
                         */
                        while (tlen > 0)
                        {
@@ -118,16 +118,16 @@ MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
                        }
 
                        /*
-                        * End of text with no match, so no point in trying later
-                        * places to start matching this pattern.
+                        * End of text with no match, so no point in trying later places
+                        * to start matching this pattern.
                         */
                        return LIKE_ABORT;
                }
                else if ((*p != '_') && !CHAREQ(t, p))
                {
                        /*
-                        * Not the single-character wildcard and no explicit match?
-                        * Then time to quit...
+                        * Not the single-character wildcard and no explicit match? Then
+                        * time to quit...
                         */
                        return LIKE_FALSE;
                }
@@ -147,8 +147,8 @@ MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
                return LIKE_TRUE;
 
        /*
-        * End of text with no match, so no point in trying later places to
-        * start matching this pattern.
+        * End of text with no match, so no point in trying later places to start
+        * matching this pattern.
         */
        return LIKE_ABORT;
 }      /* MatchText() */
@@ -157,7 +157,7 @@ MatchText(unsigned char *t, int tlen, unsigned char *p, int plen)
  * Same as above, but ignore case
  */
 static int
-MatchTextIC(unsigned char *t, int tlen, unsigned char *p, int plen)
+MatchTextIC(char *t, int tlen, char *p, int plen)
 {
        /* Fast path for match-everything pattern */
        if ((plen == 1) && (*p == '%'))
@@ -183,8 +183,8 @@ MatchTextIC(unsigned char *t, int tlen, unsigned char *p, int plen)
                                return LIKE_TRUE;
 
                        /*
-                        * Otherwise, scan for a text position at which we can match
-                        * the rest of the pattern.
+                        * Otherwise, scan for a text position at which we can match the
+                        * rest of the pattern.
                         */
                        while (tlen > 0)
                        {
@@ -204,16 +204,16 @@ MatchTextIC(unsigned char *t, int tlen, unsigned char *p, int plen)
                        }
 
                        /*
-                        * End of text with no match, so no point in trying later
-                        * places to start matching this pattern.
+                        * End of text with no match, so no point in trying later places
+                        * to start matching this pattern.
                         */
                        return LIKE_ABORT;
                }
                else if ((*p != '_') && !ICHAREQ(t, p))
                {
                        /*
-                        * Not the single-character wildcard and no explicit match?
-                        * Then time to quit...
+                        * Not the single-character wildcard and no explicit match? Then
+                        * time to quit...
                         */
                        return LIKE_FALSE;
                }
@@ -233,8 +233,8 @@ MatchTextIC(unsigned char *t, int tlen, unsigned char *p, int plen)
                return LIKE_TRUE;
 
        /*
-        * End of text with no match, so no point in trying later places to
-        * start matching this pattern.
+        * End of text with no match, so no point in trying later places to start
+        * matching this pattern.
         */
        return LIKE_ABORT;
 }      /* MatchTextIC() */
@@ -247,7 +247,7 @@ static text *
 do_like_escape(text *pat, text *esc)
 {
        text       *result;
-       unsigned char *p,
+       char       *p,
                           *e,
                           *r;
        int                     plen,
@@ -289,7 +289,7 @@ do_like_escape(text *pat, text *esc)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_ESCAPE_SEQUENCE),
                                         errmsg("invalid escape string"),
-                         errhint("Escape string must be empty or one character.")));
+                                 errhint("Escape string must be empty or one character.")));
 
                e = VARDATA(esc);
 
@@ -303,9 +303,9 @@ do_like_escape(text *pat, text *esc)
                }
 
                /*
-                * Otherwise, convert occurrences of the specified escape
-                * character to '\', and double occurrences of '\' --- unless they
-                * immediately follow an escape character!
+                * Otherwise, convert occurrences of the specified escape character to
+                * '\', and double occurrences of '\' --- unless they immediately
+                * follow an escape character!
                 */
                afterescape = false;
                while (plen > 0)
@@ -332,7 +332,7 @@ do_like_escape(text *pat, text *esc)
                }
        }
 
-       VARATT_SIZEP(result) = r - ((unsigned char *) result);
+       VARATT_SIZEP(result) = r - ((char *) result);
 
        return result;
 }