lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] svn commit: r1328154 - in /lucy/trunk/clownfish: perl/t/107-arbitrary_type.t src/CFCType.c
Date Fri, 20 Apr 2012 00:22:47 GMT
Author: marvin
Date: Fri Apr 20 00:22:47 2012
New Revision: 1328154

URL: http://svn.apache.org/viewvc?rev=1328154&view=rev
Log:
Disable auto-prefixing of arbitrary types.

Automatically adding parcel prefixes to arbitrary types is problematic because
we can't tell whether we should add "Prefix" or "prefix", and because we can't
tell reliably whether a parcel prefix is already present in a multi-parcel
environment.

Modified:
    lucy/trunk/clownfish/perl/t/107-arbitrary_type.t
    lucy/trunk/clownfish/src/CFCType.c

Modified: lucy/trunk/clownfish/perl/t/107-arbitrary_type.t
URL: http://svn.apache.org/viewvc/lucy/trunk/clownfish/perl/t/107-arbitrary_type.t?rev=1328154&r1=1328153&r2=1328154&view=diff
==============================================================================
--- lucy/trunk/clownfish/perl/t/107-arbitrary_type.t (original)
+++ lucy/trunk/clownfish/perl/t/107-arbitrary_type.t Fri Apr 20 00:22:47 2012
@@ -31,9 +31,12 @@ my $compare_t_type = Clownfish::CFC::Mod
     parcel    => 'Neato',
     specifier => "Sort_compare_t",
 );
-is( $compare_t_type->get_specifier,
-    "neato_Sort_compare_t", "Prepend prefix to specifier" );
-is( $compare_t_type->to_c, "neato_Sort_compare_t", "to_c" );
+TODO: {
+    local $TODO = "Disabled until parcels get overhauled.";
+    is( $compare_t_type->get_specifier,
+        "neato_Sort_compare_t", "Prepend prefix to specifier" );
+    is( $compare_t_type->to_c, "neato_Sort_compare_t", "to_c" );
+}
 
 my $twin = Clownfish::CFC::Model::Type->new_arbitrary(
     parcel    => 'Neato',

Modified: lucy/trunk/clownfish/src/CFCType.c
URL: http://svn.apache.org/viewvc/lucy/trunk/clownfish/src/CFCType.c?rev=1328154&r1=1328153&r2=1328154&view=diff
==============================================================================
--- lucy/trunk/clownfish/src/CFCType.c (original)
+++ lucy/trunk/clownfish/src/CFCType.c Fri Apr 20 00:22:47 2012
@@ -329,37 +329,16 @@ CFCType_new_va_list(void) {
     return CFCType_new(CFCTYPE_VA_LIST, NULL, "va_list", 0, "va_list");
 }
 
-
 CFCType*
 CFCType_new_arbitrary(CFCParcel *parcel, const char *specifier) {
-    const size_t MAX_SPECIFIER_LEN = 256;
-
-    // Add parcel prefix to what appear to be namespaced types.
-    char full_specifier[MAX_SPECIFIER_LEN + 1];
-    if (isupper(*specifier) && parcel != NULL) {
-        const char *prefix   = CFCParcel_get_prefix(parcel);
-        size_t      full_len = strlen(prefix) + strlen(specifier);
-        if (full_len > MAX_SPECIFIER_LEN) {
-            CFCUtil_die("Illegal specifier: '%s'", specifier);
-        }
-        sprintf(full_specifier, "%s%s", prefix, specifier);
-    }
-    else {
-        if (strlen(specifier) > MAX_SPECIFIER_LEN) {
-            CFCUtil_die("Illegal specifier: '%s'", specifier);
-        }
-        strcpy(full_specifier, specifier);
-    }
-
     // Validate specifier.
-    for (size_t i = 0, max = strlen(full_specifier); i < max; i++) {
-        if (!isalnum(full_specifier[i]) && full_specifier[i] != '_') {
-            CFCUtil_die("Illegal specifier: '%s'", full_specifier);
+    for (size_t i = 0, max = strlen(specifier); i < max; i++) {
+        if (!isalnum(specifier[i]) && specifier[i] != '_') {
+            CFCUtil_die("Illegal specifier: '%s'", specifier);
         }
     }
 
-    return CFCType_new(CFCTYPE_ARBITRARY, parcel, full_specifier, 0,
-                       full_specifier);
+    return CFCType_new(CFCTYPE_ARBITRARY, parcel, specifier, 0, specifier);
 }
 
 void



Mime
View raw message