~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_wcomp.c

  • Committer: Monty Taylor
  • Date: 2008-07-01 14:33:36 UTC
  • mto: (28.1.12 backport_patch)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: monty@inaugust.com-20080701143336-8uihm7dhpu92rt0q
Somehow missed moving password.c. Duh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
char wild_prefix=0; /* QQ this can potentially cause a SIGSEGV */
26
26
 
27
27
int wild_compare(register const char *str, register const char *wildstr,
28
 
                 bool str_is_pattern)
 
28
                 pbool str_is_pattern)
29
29
{
30
30
  char cmp;
 
31
  DBUG_ENTER("wild_compare");
31
32
 
32
33
  while (*wildstr)
33
34
  {
37
38
      {
38
39
        wildstr++;
39
40
        if (str_is_pattern && *str++ != wild_prefix)
40
 
          return(1);
 
41
          DBUG_RETURN(1);
41
42
      }
42
43
      if (*wildstr++ != *str++)
43
 
        return(1);
 
44
        DBUG_RETURN(1);
44
45
    }
45
46
    if (! *wildstr )
46
 
      return(*str != 0);
 
47
      DBUG_RETURN(*str != 0);
47
48
    if (*wildstr++ == wild_one)
48
49
    {
49
50
      if (! *str || (str_is_pattern && *str == wild_many))
50
 
        return(1);                     /* One char; skip */
 
51
        DBUG_RETURN(1);                     /* One char; skip */
51
52
      if (*str++ == wild_prefix && str_is_pattern && *str)
52
53
        str++;
53
54
    }
66
67
          if (str_is_pattern && *str == wild_prefix && str[1])
67
68
            str+=2;
68
69
          else if (! *str++)
69
 
            return (1);
 
70
            DBUG_RETURN (1);
70
71
        }
71
72
      if (!*wildstr)
72
 
        return(0);              /* '*' as last char: OK */
 
73
        DBUG_RETURN(0);         /* '*' as last char: OK */
73
74
      if ((cmp= *wildstr) == wild_prefix && wildstr[1] && !str_is_pattern)
74
75
        cmp=wildstr[1];
75
76
      for (;;str++)
77
78
        while (*str && *str != cmp)
78
79
          str++;
79
80
        if (!*str)
80
 
          return (1);
 
81
          DBUG_RETURN (1);
81
82
        if (wild_compare(str,wildstr,str_is_pattern) == 0)
82
 
          return (0);
 
83
          DBUG_RETURN (0);
83
84
      }
84
85
      /* We will never come here */
85
86
    }
86
87
  }
87
 
  return (*str != 0);
 
88
  DBUG_RETURN (*str != 0);
88
89
} /* wild_compare */