assorted little nits
authorGurusamy Sarathy <gsar@cpan.org>
Mon, 24 Jan 2000 15:35:12 +0000 (15:35 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Mon, 24 Jan 2000 15:35:12 +0000 (15:35 +0000)
p4raw-id: //depot/perl@4882

mg.c
win32/Makefile
win32/makefile.mk
win32/perlhost.h
win32/win32.c

diff --git a/mg.c b/mg.c
index fb2b8f1..4274a20 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1238,7 +1238,7 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg)
     SV* lsv = LvTARG(sv);
     SSize_t pos;
     STRLEN len;
-    STRLEN ulen;
+    STRLEN ulen = 0;
     dTHR;
 
     mg = 0;
@@ -1263,8 +1263,6 @@ Perl_magic_setpos(pTHX_ SV *sv, MAGIC *mg)
        ulen = sv_len_utf8(lsv);
        if (ulen)
            len = ulen;
-       else
-           ulen = 0;
     }
 
     if (pos < 0) {
index e9e4892..88eb9d8 100644 (file)
@@ -428,13 +428,8 @@ $(o).dll:
 
 #
 # various targets
-!IF "$(USE_OBJECT)" == "define"
 PERLIMPLIB     = ..\perl56.lib
 PERLDLL                = ..\perl56.dll
-!ELSE
-PERLIMPLIB     = ..\perl.lib
-PERLDLL                = ..\perl.dll
-!ENDIF
 
 MINIPERL       = ..\miniperl.exe
 MINIDIR                = .\mini
index 75f6a5c..9a44722 100644 (file)
@@ -598,13 +598,8 @@ PERL95EXE  = ..\perl95.exe
 
 .ENDIF
 
-.IF "$(USE_OBJECT)" == "define"
 PERLIMPLIB     *= ..\perl56$(a)
 PERLDLL                = ..\perl56.dll
-.ELSE
-PERLIMPLIB     *= ..\perl$(a)
-PERLDLL                = ..\perl.dll
-.ENDIF
 
 XCOPY          = xcopy /f /r /i /d
 RCOPY          = xcopy /f /r /i /e /d
index 93cb458..4b4ad58 100644 (file)
@@ -1628,7 +1628,7 @@ PerlProcSignal(struct IPerlProc* piPerl, int sig, Sighandler_t subcode)
 }
 
 #ifdef USE_ITHREADS
-static DWORD WINAPI
+static THREAD_RET_TYPE
 win32_start_child(LPVOID arg)
 {
     PerlInterpreter *my_perl = (PerlInterpreter*)arg;
@@ -1740,9 +1740,14 @@ PerlProcFork(struct IPerlProc* piPerl)
     id = win32_start_child((LPVOID)new_perl);
     PERL_SET_INTERP(aTHXo);
 #  else
+#    ifdef USE_RTL_THREAD_API
+    handle = (HANDLE)_beginthreadex((void*)NULL, 0, win32_start_child,
+                                   (void*)new_perl, 0, (unsigned*)&id);
+#    else
     handle = CreateThread(NULL, 0, win32_start_child,
                          (LPVOID)new_perl, 0, &id);
-    PERL_SET_INTERP(aTHXo);
+#    endif
+    PERL_SET_INTERP(aTHXo);    /* XXX perl_clone*() set TLS */
     if (!handle)
        Perl_croak(aTHX_ "panic: pseudo fork() failed");
     w32_pseudo_child_handles[w32_num_pseudo_children] = handle;
index 710a047..fade1c4 100644 (file)
@@ -942,9 +942,9 @@ remove_dead_process(long child)
     if (child >= 0) {
        dTHXo;
        CloseHandle(w32_child_handles[child]);
-       Copy(&w32_child_handles[child+1], &w32_child_handles[child],
+       Move(&w32_child_handles[child+1], &w32_child_handles[child],
             (w32_num_children-child-1), HANDLE);
-       Copy(&w32_child_pids[child+1], &w32_child_pids[child],
+       Move(&w32_child_pids[child+1], &w32_child_pids[child],
             (w32_num_children-child-1), DWORD);
        w32_num_children--;
     }
@@ -969,9 +969,9 @@ remove_dead_pseudo_process(long child)
     if (child >= 0) {
        dTHXo;
        CloseHandle(w32_pseudo_child_handles[child]);
-       Copy(&w32_pseudo_child_handles[child+1], &w32_pseudo_child_handles[child],
+       Move(&w32_pseudo_child_handles[child+1], &w32_pseudo_child_handles[child],
             (w32_num_pseudo_children-child-1), HANDLE);
-       Copy(&w32_pseudo_child_pids[child+1], &w32_pseudo_child_pids[child],
+       Move(&w32_pseudo_child_pids[child+1], &w32_pseudo_child_pids[child],
             (w32_num_pseudo_children-child-1), DWORD);
        w32_num_pseudo_children--;
     }
@@ -1397,6 +1397,8 @@ win32_unlink(const char *filename)
        A2WHELPER(filename, wBuffer, sizeof(wBuffer));
        wcscpy(wBuffer, PerlDir_mapW(wBuffer));
        attrs = GetFileAttributesW(wBuffer);
+       if (attrs == 0xFFFFFFFF)
+           goto fail;
        if (attrs & FILE_ATTRIBUTE_READONLY) {
            (void)SetFileAttributesW(wBuffer, attrs & ~FILE_ATTRIBUTE_READONLY);
            ret = _wunlink(wBuffer);
@@ -1409,6 +1411,8 @@ win32_unlink(const char *filename)
     else {
        filename = PerlDir_mapA(filename);
        attrs = GetFileAttributesA(filename);
+       if (attrs == 0xFFFFFFFF)
+           goto fail;
        if (attrs & FILE_ATTRIBUTE_READONLY) {
            (void)SetFileAttributesA(filename, attrs & ~FILE_ATTRIBUTE_READONLY);
            ret = unlink(filename);
@@ -1419,6 +1423,9 @@ win32_unlink(const char *filename)
            ret = unlink(filename);
     }
     return ret;
+fail:
+    errno = ENOENT;
+    return -1;
 }
 
 DllExport int