bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unictype.h: Add missing API


From: Bruno Haible
Subject: unictype.h: Add missing API
Date: Sun, 5 Apr 2009 12:18:22 +0200
User-agent: KMail/1.9.9

The unictype.h lacks an API for testing whether the result of the function
uc_property_byname is valid or not. This fixes it.

2009-04-05  Bruno Haible  <address@hidden>

        * lib/unictype.h (uc_property_is_valid): New macro.
        * tests/unictype/test-pr_byname.c (main): Use it.

*** lib/unictype.h.orig 2009-04-05 12:16:05.000000000 +0200
--- lib/unictype.h      2009-04-05 12:15:57.000000000 +0200
***************
*** 463,468 ****
--- 463,471 ----
  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);
*** tests/unictype/test-pr_byname.c.orig        2009-04-05 12:16:05.000000000 
+0200
--- tests/unictype/test-pr_byname.c     2009-03-29 21:06:23.000000000 +0200
***************
*** 1,5 ****
  /* Test the Unicode character type functions.
!    Copyright (C) 2007-2008 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
--- 1,5 ----
  /* Test the Unicode character type functions.
!    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,53 ****
  
    {
      uc_property_t pr = uc_property_byname ("foobar");
!     ASSERT (pr.test_fn == NULL);
    }
  
    return 0;
--- 47,53 ----
  
    {
      uc_property_t pr = uc_property_byname ("foobar");
!     ASSERT (! uc_property_is_valid (pr));
    }
  
    return 0;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]