Author: Armin Rigo <ar...@tunes.org>
Branch: portable-threadlocal
Changeset: r74633:cba625508157
Date: 2014-11-22 18:36 +0100
http://bitbucket.org/pypy/pypy/changeset/cba625508157/

Log:    small fixes

diff --git a/rpython/rlib/rthread.py b/rpython/rlib/rthread.py
--- a/rpython/rlib/rthread.py
+++ b/rpython/rlib/rthread.py
@@ -316,7 +316,7 @@
         def set(value):
             assert isinstance(value, Cls) or value is None
             if we_are_translated():
-                from rpython.rtyper.annlowlevel import 
cast_instance_to_base_ptr
+                from rpython.rtyper.annlowlevel import cast_instance_to_gcref
                 from rpython.rlib.rgc import _make_sure_does_not_move
                 from rpython.rlib.objectmodel import running_on_llinterp
                 gcref = cast_instance_to_gcref(value)
diff --git a/rpython/translator/c/src/threadlocal.c 
b/rpython/translator/c/src/threadlocal.c
--- a/rpython/translator/c/src/threadlocal.c
+++ b/rpython/translator/c/src/threadlocal.c
@@ -6,18 +6,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 #include "src/threadlocal.h"
 #include "src/thread.h"
 
 
-static void _RPython_ThreadLocals_Init(char *p)
+static void _RPython_ThreadLocals_Init(void *p)
 {
-    struct pypy_threadlocal_s *tl = (struct pypy_threadlocal_s *)p;
+    memset(p, 0, sizeof(struct pypy_threadlocal_s));
 #ifdef RPY_TLOFS_p_errno
-    tl->p_errno = &errno;
+    ((struct pypy_threadlocal_s *)p)->p_errno = &errno;
 #endif
 #ifdef RPY_TLOFS_thread_ident
-    tl->thread_ident = RPyThreadGetIdent();
+    ((struct pypy_threadlocal_s *)p)->thread_ident = RPyThreadGetIdent();
 #endif
 }
 
@@ -67,7 +68,7 @@
 
 void RPython_ThreadLocals_ThreadStart(void)
 {
-    char *p = malloc(sizeof(struct pypy_threadlocal_s));
+    void *p = malloc(sizeof(struct pypy_threadlocal_s));
     if (!p) {
         fprintf(stderr, "Internal RPython error: "
                         "out of memory for the thread-local storage");
@@ -83,7 +84,7 @@
 
 void RPython_ThreadLocals_ThreadDie(void)
 {
-    char *p;
+    void *p;
     OP_THREADLOCALREF_ADDR(p);
     free(p);
 }
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to