]> granicus.if.org Git - icu/commitdiff
ICU-10070 uregion_isEqualTo -> uregion_areEqual, implement using pointer compare
authorPeter Edberg <pedberg@unicode.org>
Thu, 2 May 2013 22:04:50 +0000 (22:04 +0000)
committerPeter Edberg <pedberg@unicode.org>
Thu, 2 May 2013 22:04:50 +0000 (22:04 +0000)
X-SVN-Rev: 33578

icu4c/source/i18n/unicode/uregion.h
icu4c/source/i18n/uregion.cpp
icu4c/source/test/cintltst/uregiontest.c

index 48b7c966828b3e442fc2bbd656a8087cc5b1d58b..46143ce8b739b934662f997c93009d848a21048c 100644 (file)
@@ -127,7 +127,7 @@ typedef struct URegion URegion;
 
 /**
  * Returns a pointer to a URegion for the specified region code: A 2-letter or 3-letter ISO 3166
- * code, UNM.49 numeric code (superset of ISO 3166 numeric codes), or other valid Unicode Region
+ * code, UN M.49 numeric code (superset of ISO 3166 numeric codes), or other valid Unicode Region
  * Code as defined by the LDML specification. The code will be canonicalized internally. If the
  * region code is NULL or not recognized, the appropriate error code will be set
  * (U_ILLEGAL_ARGUMENT_ERROR).
@@ -157,7 +157,7 @@ uregion_getAvailable(URegionType type, UErrorCode *status);
  * @draft ICU 52
  */
 U_DRAFT UBool U_EXPORT2
-uregion_isEqualTo(const URegion* uregion, const URegion* otherRegion);
+uregion_areEqual(const URegion* uregion, const URegion* otherRegion);
 
 /**
  * Returns a pointer to the URegion that contains the specified uregion. Returns NULL if the
index 16188341501613fc7bc017819826220ba2b3fe2e..5e4ba4ca52852a0196a5978e12d66d7f7d40257f 100644 (file)
@@ -38,9 +38,9 @@ uregion_getAvailable(URegionType type, UErrorCode *status)
 
 
 U_CAPI UBool U_EXPORT2
-uregion_isEqualTo(const URegion* uregion, const URegion* otherRegion)
+uregion_areEqual(const URegion* uregion, const URegion* otherRegion)
 {
-    return ( (Region*)uregion == (Region*)otherRegion );
+    return ( (void*)uregion == (void*)otherRegion );
 }
 
 
index 0dc94b1db1c482dd9dcf4007245c28743687b71a..c86355bf9b43e49800c12a95f73f8c9fa8da04f9 100644 (file)
@@ -369,7 +369,7 @@ static void TestKnownRegions() {
             }
             if ( e > 0 ) {
                 const URegion *ncRegion = uregion_getRegionFromNumericCode(e, &status);
-                if ( !uregion_isEqualTo(ncRegion, r) && e != 891 ) { // 891 is special case - CS and YU both deprecated codes for region 891
+                if ( !uregion_areEqual(ncRegion, r) && e != 891 ) { // 891 is special case - CS and YU both deprecated codes for region 891
                     log_err("ERROR: Creating region %s by its numeric code returned a different region. Got: %s instead.\n",
                         uregion_getRegionCode(r), uregion_getRegionCode(ncRegion) );
                 }
@@ -396,7 +396,7 @@ static void TestGetContainedRegions() {
                 while ((crID = uenum_next(containedRegions, NULL, &status)) != NULL && U_SUCCESS(status) ) {
                     const URegion *cr = uregion_getRegionFromCode(crID, &status);
                     const URegion *containingRegion = (cr)? uregion_getContainingRegion(cr) : NULL;
-                    if ( !containingRegion || !uregion_isEqualTo(containingRegion, r) ) {
+                    if ( !containingRegion || !uregion_areEqual(containingRegion, r) ) {
                         log_err("ERROR: Region: %s contains region %s. Expected containing region of this region to be the original region, but got %s\n",
                             uregion_getRegionCode(r), uregion_getRegionCode(cr), (containingRegion)?uregion_getRegionCode(containingRegion):"NULL" ); 
                     }
@@ -425,7 +425,7 @@ static void TestGetContainedRegionsWithType() {
                 while ((crID = uenum_next(containedRegions, NULL, &status)) != NULL && U_SUCCESS(status) ) {
                     const URegion *cr = uregion_getRegionFromCode(crID, &status);
                     const URegion *containingRegion = (cr)? uregion_getContainingRegionOfType(cr, URGN_CONTINENT) : NULL;
-                    if ( !containingRegion || !uregion_isEqualTo(containingRegion, r) ) {
+                    if ( !containingRegion || !uregion_areEqual(containingRegion, r) ) {
                         log_err("ERROR: Continent: %s contains territory %s. Expected containing continent of this region to be the original region, but got %s\n",
                             uregion_getRegionCode(r), uregion_getRegionCode(cr), (containingRegion)?uregion_getRegionCode(containingRegion):"NULL" ); 
                     }
@@ -451,7 +451,7 @@ static void TestGetContainingRegion() {
                 }
             } else {
                 const URegion *p = uregion_getRegionFromCode(rd->parent, &status);                   
-                if ( c == NULL || !uregion_isEqualTo(p, c) ) {
+                if ( c == NULL || !uregion_areEqual(p, c) ) {
                     log_err("ERROR: Expected containing continent of region %s to be %s. Got: %s\n",
                         uregion_getRegionCode(r), (p)?uregion_getRegionCode(p):"NULL", (c)?uregion_getRegionCode(c):"NULL" );
                 }
@@ -475,7 +475,7 @@ static void TestGetContainingRegionWithType() {
                  }
             } else {
                 const URegion *p = uregion_getRegionFromCode(rd->containingContinent, &status);                   
-                if ( !uregion_isEqualTo(p, c) ) {
+                if ( !uregion_areEqual(p, c) ) {
                     log_err("ERROR: Expected containing continent of region %s to be %s. Got: %s\n",
                         uregion_getRegionCode(r), (p)?uregion_getRegionCode(p):"NULL", (c)?uregion_getRegionCode(c):"NULL" );
                 }