[pypy-commit] cffi windows-tls: fixes

arigo pypy.commits at gmail.com
Sun Jan 3 08:02:34 EST 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: windows-tls
Changeset: r2525:e7900ea4b1fd
Date: 2016-01-03 14:02 +0100
http://bitbucket.org/cffi/cffi/changeset/e7900ea4b1fd/

Log:	fixes

diff --git a/c/misc_win32.h b/c/misc_win32.h
--- a/c/misc_win32.h
+++ b/c/misc_win32.h
@@ -46,13 +46,13 @@
     LPVOID p = TlsGetValue(cffi_tls_index);
 
     if (p == NULL) {
-        p = malloc(sizeof(struct cffi_errno_s));
+        p = malloc(sizeof(struct cffi_tls_s));
         if (p == NULL)
             return NULL;
-        memset(p, 0, sizeof(struct cffi_errno_s));
+        memset(p, 0, sizeof(struct cffi_tls_s));
         TlsSetValue(cffi_tls_index, p);
     }
-    return (struct cffi_errno_s *)p;
+    return (struct cffi_tls_s *)p;
 }
 
 #ifdef USE__THREAD
@@ -97,8 +97,7 @@
         return NULL;
 
     if (err == -1) {
-        struct cffi_errno_s *p;
-        p = _geterrno_object();
+        struct cffi_tls_s *p = get_cffi_tls();
         if (p == NULL)
             return PyErr_NoMemory();
         err = p->saved_lasterror;
@@ -139,7 +138,7 @@
     int len;
     char *s;
     char *s_buf = NULL; /* Free via LocalFree */
-    char s_small_buf[28]; /* Room for "Windows Error 0xFFFFFFFF" */
+    char s_small_buf[40]; /* Room for "Windows Error 0xFFFFFFFFFFFFFFFF" */
     PyObject *v;
     static char *keywords[] = {"code", NULL};
 
@@ -147,8 +146,7 @@
         return NULL;
 
     if (err == -1) {
-        struct cffi_errno_s *p;
-        p = _geterrno_object();
+        struct cffi_tls_s *p = get_cffi_tls();
         if (p == NULL)
             return PyErr_NoMemory();
         err = p->saved_lasterror;


More information about the pypy-commit mailing list