mirror of
https://github.com/postgres/postgres.git
synced 2025-05-06 19:59:18 +03:00
Fix broken definition of :print: character class, per Bruno Wolff.
Also, make :alnum: character class directly dependent on isalnum() rather than guessing.
This commit is contained in:
parent
3b97d9f525
commit
5594aa6a6e
@ -47,7 +47,7 @@
|
|||||||
* permission to use and distribute the software in accordance with the
|
* permission to use and distribute the software in accordance with the
|
||||||
* terms specified in this license.
|
* terms specified in this license.
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/regex/regc_locale.c,v 1.3 2003/08/08 21:41:56 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/regex/regc_locale.c,v 1.4 2003/09/29 00:21:58 tgl Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ASCII character-name table */
|
/* ASCII character-name table */
|
||||||
@ -388,6 +388,12 @@ pg_isgraph(pg_wchar c)
|
|||||||
return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c));
|
return (c >= 0 && c <= UCHAR_MAX && isgraph((unsigned char) c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
pg_isprint(pg_wchar c)
|
||||||
|
{
|
||||||
|
return (c >= 0 && c <= UCHAR_MAX && isprint((unsigned char) c));
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
pg_ispunct(pg_wchar c)
|
pg_ispunct(pg_wchar c)
|
||||||
{
|
{
|
||||||
@ -657,16 +663,25 @@ cclass(struct vars * v, /* context */
|
|||||||
switch ((enum classes) index)
|
switch ((enum classes) index)
|
||||||
{
|
{
|
||||||
case CC_PRINT:
|
case CC_PRINT:
|
||||||
case CC_ALNUM:
|
cv = getcvec(v, UCHAR_MAX, 0, 0);
|
||||||
cv = getcvec(v, UCHAR_MAX, 1, 0);
|
|
||||||
if (cv)
|
if (cv)
|
||||||
{
|
{
|
||||||
for (i = 0; i <= UCHAR_MAX; i++)
|
for (i = 0; i <= UCHAR_MAX; i++)
|
||||||
{
|
{
|
||||||
if (pg_isalpha((chr) i))
|
if (pg_isprint((chr) i))
|
||||||
|
addchr(cv, (chr) i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CC_ALNUM:
|
||||||
|
cv = getcvec(v, UCHAR_MAX, 0, 0);
|
||||||
|
if (cv)
|
||||||
|
{
|
||||||
|
for (i = 0; i <= UCHAR_MAX; i++)
|
||||||
|
{
|
||||||
|
if (pg_isalnum((chr) i))
|
||||||
addchr(cv, (chr) i);
|
addchr(cv, (chr) i);
|
||||||
}
|
}
|
||||||
addrange(cv, (chr) '0', (chr) '9');
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CC_ALPHA:
|
case CC_ALPHA:
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/backend/regex/regcomp.c,v 1.38 2003/08/08 21:41:56 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/regex/regcomp.c,v 1.39 2003/09/29 00:21:58 tgl Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -184,6 +184,7 @@ static int pg_isalnum(pg_wchar c);
|
|||||||
static int pg_isupper(pg_wchar c);
|
static int pg_isupper(pg_wchar c);
|
||||||
static int pg_islower(pg_wchar c);
|
static int pg_islower(pg_wchar c);
|
||||||
static int pg_isgraph(pg_wchar c);
|
static int pg_isgraph(pg_wchar c);
|
||||||
|
static int pg_isprint(pg_wchar c);
|
||||||
static int pg_ispunct(pg_wchar c);
|
static int pg_ispunct(pg_wchar c);
|
||||||
static int pg_isspace(pg_wchar c);
|
static int pg_isspace(pg_wchar c);
|
||||||
static pg_wchar pg_toupper(pg_wchar c);
|
static pg_wchar pg_toupper(pg_wchar c);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user