lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [lucy-commits] [03/17] git commit: refs/heads/cfish-string-prep1 - Eliminate SStr_Assign_Trusted_Str in XSBind.c
Date Fri, 13 Sep 2013 18:31:35 GMT
Eliminate SStr_Assign_Trusted_Str in XSBind.c


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

Branch: refs/heads/cfish-string-prep1
Commit: 051e87beff3d806f0ab7c1169bd08890f9225e37
Parents: a3e5cf9
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Sat Sep 7 20:32:35 2013 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Mon Sep 9 20:17:51 2013 +0200

----------------------------------------------------------------------
 clownfish/runtime/perl/xs/XSBind.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/051e87be/clownfish/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/xs/XSBind.c b/clownfish/runtime/perl/xs/XSBind.c
index a67e07c..2cfaaade 100644
--- a/clownfish/runtime/perl/xs/XSBind.c
+++ b/clownfish/runtime/perl/xs/XSBind.c
@@ -237,9 +237,8 @@ XSBind_str_to_sv(const cfish_String *str) {
 
 static cfish_Hash*
 S_perl_hash_to_cfish_hash(HV *phash) {
-    uint32_t             num_keys = hv_iterinit(phash);
-    cfish_Hash          *retval   = cfish_Hash_new(num_keys);
-    cfish_StackString *key      = CFISH_SStr_WRAP_STR("", 0);
+    uint32_t    num_keys = hv_iterinit(phash);
+    cfish_Hash *retval   = cfish_Hash_new(num_keys);
 
     while (num_keys--) {
         HE        *entry    = hv_iternext(phash);
@@ -253,12 +252,10 @@ S_perl_hash_to_cfish_hash(HV *phash) {
             // this.
             SV   *key_sv  = HeKEY_sv(entry);
             char *key_str = SvPVutf8(key_sv, key_len);
-            CFISH_SStr_Assign_Trusted_Str(key, key_str, key_len);
-            CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
+            CFISH_Hash_Store_Str(retval, key_str, key_len, value);
         }
         else if (HeKUTF8(entry)) {
-            CFISH_SStr_Assign_Trusted_Str(key, HeKEY(entry), key_len);
-            CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
+            CFISH_Hash_Store_Str(retval, HeKEY(entry), key_len, value);
         }
         else {
             char *key_str = HeKEY(entry);
@@ -267,14 +264,12 @@ S_perl_hash_to_cfish_hash(HV *phash) {
                 if ((key_str[i] & 0x80) == 0x80) { pure_ascii = false; }
             }
             if (pure_ascii) {
-                CFISH_SStr_Assign_Trusted_Str(key, key_str, key_len);
-                CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
+                CFISH_Hash_Store_Str(retval, key_str, key_len, value);
             }
             else {
                 SV *key_sv = HeSVKEY_force(entry);
                 key_str = SvPVutf8(key_sv, key_len);
-                CFISH_SStr_Assign_Trusted_Str(key, key_str, key_len);
-                CFISH_Hash_Store(retval, (cfish_Obj*)key, value);
+                CFISH_Hash_Store_Str(retval, key_str, key_len, value);
             }
         }
     }


Mime
View raw message