# HG changeset patch # User Bruno Haible # Date 1238926597 -7200 # Node ID e9190cf184a27cf091e7fa2ec9620b67a2119128 # Parent 1b9f62427f8b1bfbd880290d78ad880214566731 New macro uc_property_is_valid. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2009-04-05 Bruno Haible + * lib/unictype.h (uc_property_is_valid): New macro. + * tests/unictype/test-pr_byname.c (main): Use it. + * lib/unistr.h: Doc fixes. * lib/uniconv.h: Doc fixes. * lib/unictype.h: Doc fixes. diff --git a/lib/unictype.h b/lib/unictype.h --- a/lib/unictype.h +++ b/lib/unictype.h @@ -463,6 +463,9 @@ extern uc_property_t uc_property_byname (const char *property_name); +/* Test whether a property is valid. */ +#define uc_property_is_valid(property) ((property).test_fn != NULL) + /* Test whether a Unicode character has a given property. */ extern bool uc_is_property (ucs4_t uc, uc_property_t property); diff --git a/tests/unictype/test-pr_byname.c b/tests/unictype/test-pr_byname.c --- a/tests/unictype/test-pr_byname.c +++ b/tests/unictype/test-pr_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,7 +47,7 @@ { uc_property_t pr = uc_property_byname ("foobar"); - ASSERT (pr.test_fn == NULL); + ASSERT (! uc_property_is_valid (pr)); } return 0;