New macro uc_property_is_valid.
authorBruno Haible <bruno@clisp.org>
Sun, 5 Apr 2009 10:16:37 +0000 (12:16 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 5 Apr 2009 10:16:37 +0000 (12:16 +0200)
ChangeLog
lib/unictype.h
tests/unictype/test-pr_byname.c

index e30025f4059d64c3fccb61add6d83030064cca40..2e91973f3084fe28aae724ca36f768a9e08844eb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-04-05  Bruno Haible  <bruno@clisp.org>
 
+       * 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.
index acf093b91cf231c50b864a9d13ed6684f37d4827..ae47d1153f423b7535b36d80bdcc2cd86e13be02 100644 (file)
@@ -463,6 +463,9 @@ extern const uc_property_t UC_PROPERTY_IGNORABLE_CONTROL;
 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);
index 1b4a935766c82ce21a4c0f34be8995b99433b599..770d4c8fd252c0ae78249af253336d101223db95 100644 (file)
@@ -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 @@ main ()
 
   {
     uc_property_t pr = uc_property_byname ("foobar");
-    ASSERT (pr.test_fn == NULL);
+    ASSERT (! uc_property_is_valid (pr));
   }
 
   return 0;