[pypy-commit] cffi default: Move a repeated piece of code before.

arigo noreply at buildbot.pypy.org
Sat Aug 4 16:16:56 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r767:ed53c57cec4a
Date: 2012-08-04 16:15 +0200
http://bitbucket.org/cffi/cffi/changeset/ed53c57cec4a/

Log:	Move a repeated piece of code before.

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -3822,11 +3822,11 @@
             }
             return NULL;
         }
+        if (length < 0 && cd->c_type->ct_flags & CT_ARRAY) {
+            length = get_array_length(cd);
+        }
         if (cd->c_type->ct_itemdescr->ct_size == sizeof(char)) {
             const char *start = cd->c_data;
-            if (length < 0 && cd->c_type->ct_flags & CT_ARRAY) {
-                length = get_array_length(cd);
-            }
             if (length < 0)
                 length = strlen(start);
             else {
@@ -3841,9 +3841,6 @@
         else if (cd->c_type->ct_itemdescr->ct_flags & CT_PRIMITIVE_CHAR) {
             const wchar_t *start = (wchar_t *)cd->c_data;
             assert(cd->c_type->ct_itemdescr->ct_size == sizeof(wchar_t));
-            if (length < 0 && cd->c_type->ct_flags & CT_ARRAY) {
-                length = get_array_length(cd);
-            }
             if (length < 0) {
                 length = 0;
                 while (start[length])


More information about the pypy-commit mailing list