Integrate from ansi branch to mainline.
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index bc90b55..8f515f9 100644 (file)
--- a/util.c
+++ b/util.c
@@ -867,9 +867,9 @@ fbm_instr(unsigned char *big, register unsigned char *bigend, SV *littlestr)
        if (!len) {
            if (SvTAIL(littlestr)) {
                if (bigend > big && bigend[-1] == '\n')
-                   return bigend - 1;
+                   return (char *)(bigend - 1);
                else
-                   return bigend;
+                   return (char *) bigend;
            }
            return (char*)big;
        }
@@ -2322,7 +2322,7 @@ void
 perl_cond_signal(cp)
 perl_cond *cp;
 {
-    perl_thread t;
+    perl_os_thread t;
     perl_cond cond = *cp;
     
     if (!cond)
@@ -2343,7 +2343,7 @@ void
 perl_cond_broadcast(cp)
 perl_cond *cp;
 {
-    perl_thread t;
+    perl_os_thread t;
     perl_cond cond, cond_next;
     
     for (cond = *cp; cond; cond = cond_next) {
@@ -2382,14 +2382,14 @@ perl_cond *cp;
 #endif /* FAKE_THREADS */
 
 #ifdef OLD_PTHREADS_API
-struct thread *
+struct perl_thread *
 getTHR _((void))
 {
     pthread_addr_t t;
 
     if (pthread_getspecific(thr_key, &t))
        croak("panic: pthread_getspecific");
-    return (struct thread *) t;
+    return (struct perl_thread *) t;
 }
 #endif /* OLD_PTHREADS_API */
 
@@ -2438,20 +2438,20 @@ condpair_magic(SV *sv)
  * called. The use by ext/Thread/Thread.xs in core perl (where t is the
  * thread calling new_struct_thread) clearly satisfies this constraint.
  */
-struct thread *
-new_struct_thread(struct thread *t)
+struct perl_thread *
+new_struct_thread(struct perl_thread *t)
 {
-    struct thread *thr;
+    struct perl_thread *thr;
     SV *sv;
     SV **svp;
     I32 i;
 
     sv = newSVpv("", 0);
-    SvGROW(sv, sizeof(struct thread) + 1);
-    SvCUR_set(sv, sizeof(struct thread));
+    SvGROW(sv, sizeof(struct perl_thread) + 1);
+    SvCUR_set(sv, sizeof(struct perl_thread));
     thr = (Thread) SvPVX(sv);
     /* debug */
-    memset(thr, 0xab, sizeof(struct thread));
+    memset(thr, 0xab, sizeof(struct perl_thread));
     markstack = 0;
     scopestack = 0;
     savestack = 0;
@@ -2465,7 +2465,7 @@ new_struct_thread(struct thread *t)
 
     curcop = &compiling;
     thr->cvcache = newHV();
-    thr->magicals = newAV();
+    thr->threadsv = newAV();
     thr->specific = newAV();
     thr->errsv = newSVpv("", 0);
     thr->errhv = newHV();
@@ -2506,16 +2506,15 @@ new_struct_thread(struct thread *t)
     bodytarget = newSVsv(t->Tbodytarget);
     toptarget = newSVsv(t->Ttoptarget);
     
-    /* Initialise all per-thread magicals that the template thread used */
-    svp = AvARRAY(t->magicals);
-    for (i = 0; i <= AvFILL(t->magicals); i++, svp++) {
+    /* Initialise all per-thread SVs that the template thread used */
+    svp = AvARRAY(t->threadsv);
+    for (i = 0; i <= AvFILL(t->threadsv); i++, svp++) {
        if (*svp && *svp != &sv_undef) {
            SV *sv = newSVsv(*svp);
-           av_store(thr->magicals, i, sv);
-           sv_magic(sv, 0, 0, &per_thread_magicals[i], 1);
+           av_store(thr->threadsv, i, sv);
+           sv_magic(sv, 0, 0, &threadsv_names[i], 1);
            DEBUG_L(PerlIO_printf(PerlIO_stderr(),
-                                 "new_struct_thread: copied magical %d %p->%p\n",i,
-                                  t, thr));
+               "new_struct_thread: copied threadsv %d %p->%p\n",i, t, thr));
        }
     } 
 
@@ -2548,3 +2547,4 @@ Perl_huge(void)
 }
 #endif
 
+