lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [11/15] git commit: refs/heads/cfish-string-prep1 - Introduce Str_init_from_trusted_utf8
Date Mon, 02 Sep 2013 19:16:42 GMT
Introduce Str_init_from_trusted_utf8


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3e924ab7
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3e924ab7
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3e924ab7

Branch: refs/heads/cfish-string-prep1
Commit: 3e924ab7a3b42c9e23031a649bf9cd5e31654614
Parents: a94a2c1
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Mon Sep 2 20:27:31 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Mon Sep 2 21:12:30 2013 +0200

----------------------------------------------------------------------
 clownfish/runtime/core/Clownfish/String.c   | 7 ++++++-
 clownfish/runtime/core/Clownfish/String.cfh | 6 ++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/3e924ab7/clownfish/runtime/core/Clownfish/String.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.c b/clownfish/runtime/core/Clownfish/String.c
index 2a46393..e2d58b2 100644
--- a/clownfish/runtime/core/Clownfish/String.c
+++ b/clownfish/runtime/core/Clownfish/String.c
@@ -74,13 +74,18 @@ Str_new_from_utf8(const char *ptr, size_t size) {
     if (!StrHelp_utf8_valid(ptr, size)) {
         DIE_INVALID_UTF8(ptr, size);
     }
-    return Str_new_from_trusted_utf8(ptr, size);
+    String *self = (String*)VTable_Make_Obj(STRING);
+    return Str_init_from_trusted_utf8(self, ptr, size);
 }
 
 String*
 Str_new_from_trusted_utf8(const char *ptr, size_t size) {
     String *self = (String*)VTable_Make_Obj(STRING);
+    return Str_init_from_trusted_utf8(self, ptr, size);
+}
 
+String*
+Str_init_from_trusted_utf8(String *self, const char *ptr, size_t size) {
     // Derive.
     self->ptr = (char*)MALLOCATE(size + 1);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/3e924ab7/clownfish/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/String.cfh b/clownfish/runtime/core/Clownfish/String.cfh
index db8689b..13cf2d8 100644
--- a/clownfish/runtime/core/Clownfish/String.cfh
+++ b/clownfish/runtime/core/Clownfish/String.cfh
@@ -45,6 +45,12 @@ class Clownfish::String cnick Str
     inert incremented String*
     new_from_trusted_utf8(const char *utf8, size_t size);
 
+    /** Initialize the String using the passed-in string.  Do not check
+     * validity of supplied UTF-8.
+     */
+    inert String*
+    init_from_trusted_utf8(String *self, const char *utf8, size_t size);
+
     /** Return a pointer to a new String which assumes ownership of the
      * passed-in string.  Check validity of supplied UTF-8.
      */


Mime
View raw message