Change 30036 by [EMAIL PROTECTED] on 2007/01/27 17:35:47

        Integrate:
        [ 26593]
        Subject: [EMAIL PROTECTED] utf8.c const issue.
        From: "John E. Malmberg" <[EMAIL PROTECTED]>
        Date: Mon, 02 Jan 2006 14:16:02 -0500
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 28733]
        syscall() declaration in perl.h needs to have an EXTERN_C prefixing
        it for some C++ compiles.  Might as well fix usleep()'s 
        declaration too.
        
        [ 28734]
        Subject: [PATCH] Re: A large-ish C++ TODO (Re: [PATCH] g++ stage 1 
reached)
        From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
        Date: Thu, 17 Aug 2006 19:16:09 +0300
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 28737]
        Subject: [PATCH] g++/Solaris: force d_dlopen=define
        From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
        Date: Fri, 18 Aug 2006 15:48:34 +0300 (EEST)
        Message-Id: <[EMAIL PROTECTED]>
        
        [ 28742]
        Subject: [PATCH] g++/x2p (better version)
        From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
        Date: Mon, 21 Aug 2006 14:48:26 +0300 (EEST)
        Message-Id: <[EMAIL PROTECTED]>
        
        [ 28763]
        More conditional defines of EXTERN_C, by Jarkko
        
        [ 28765]
        Added an additional #ifndef based on comments by Jarkko and
        John Malmberg.
        
        [ 28767]
        Revert bogus change 28763.
        
        [ 28814]
        Subject: [PATCH] C++: Solaris CC now compiles "perl"
        From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
        Date: Sat, 09 Sep 2006 15:29:12 +0300
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 28823]
        Subject: [PATCH] Re: C++ status [Fwd: Smoke [5.9.4] 28776 FAIL(FM) OSF1 
V5.1 (EV6/4 cpu)]
        From: Dominic Dunlop <[EMAIL PROTECTED]>
        Date: Tue, 12 Sep 2006 09:13:41 +0200
        Message-Id: <[EMAIL PROTECTED]>
        
        [ 28844]
        Subject: Re: Re: [PATCH] C++: Solaris CC now compiles "perl"
        From: demerphq <[EMAIL PROTECTED]>
        Date: Thu, 14 Sep 2006 14:28:16 +0200
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 28848]
        More hacking in util.c's ifdef jungle following 28844 to avoid
        duplicate definition of Perl_my_setenv on VMS.
        
        [ 28860]
        Subject: [PATCH] util.c: restore Perl_my_setenv() to pre-28814
        From: Jarkko Hietaniemi <[EMAIL PROTECTED]>
        Date: Sun, 17 Sep 2006 10:29:08 +0300
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/maint-5.8/perl/EXTERN.h#5 integrate
... //depot/maint-5.8/perl/INTERN.h#5 integrate
... //depot/maint-5.8/perl/XSUB.h#36 integrate
... //depot/maint-5.8/perl/hints/solaris_2.sh#17 integrate
... //depot/maint-5.8/perl/mathoms.c#26 integrate
... //depot/maint-5.8/perl/op.h#32 integrate
... //depot/maint-5.8/perl/opcode.h#24 integrate
... //depot/maint-5.8/perl/opcode.pl#31 integrate
... //depot/maint-5.8/perl/perl.h#145 integrate
... //depot/maint-5.8/perl/perlio.c#96 integrate
... //depot/maint-5.8/perl/sv.c#327 integrate
... //depot/maint-5.8/perl/unixish.h#10 integrate
... //depot/maint-5.8/perl/utf8.c#75 edit
... //depot/maint-5.8/perl/util.c#136 integrate
... //depot/maint-5.8/perl/x2p/EXTERN.h#6 integrate
... //depot/maint-5.8/perl/x2p/INTERN.h#6 integrate
... //depot/maint-5.8/perl/x2p/hash.h#6 integrate

Differences ...

==== //depot/maint-5.8/perl/XSUB.h#36 (text) ====
Index: perl/XSUB.h
--- perl/XSUB.h#35~29968~       2007-01-25 02:55:13.000000000 -0800
+++ perl/XSUB.h 2007-01-27 09:35:47.000000000 -0800
@@ -102,7 +102,11 @@
 #  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
 #    define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
 #  else
-#    define XS(name) void name(pTHX_ CV* cv)
+#    ifdef __cplusplus
+#      define XS(name) extern "C" void name(pTHX_ CV* cv)
+#    else
+#      define XS(name) void name(pTHX_ CV* cv)
+#    endif
 #  endif
 #endif
 

==== //depot/maint-5.8/perl/hints/solaris_2.sh#17 (text) ====
Index: perl/hints/solaris_2.sh
--- perl/hints/solaris_2.sh#16~26117~   2005-11-13 13:53:32.000000000 -0800
+++ perl/hints/solaris_2.sh     2007-01-27 09:35:47.000000000 -0800
@@ -628,3 +628,27 @@
 EOOVER
 
 rm -f try.c try.o try a.out
+
+# If using C++, the Configure scan for dlopen() will fail in Solaris
+# because one of the two (1) an extern "C" linkage definition is needed
+# (2) #include <dlfcn.h> is needed, *and* a cast to (void*(*)())
+# is needed for the &dlopen.  Adding any of these would require changing
+# a delicate spot in Configure, so easier just to force our guess here
+# for Solaris.
+case "$cc" in
+*g++*|/opt/SUNWspro/bin/CC) d_dlopen='define' ;;
+esac
+
+# The Sun C++ doesn't define the global environ array.
+case "$cc" in
+/opt/SUNWspro/bin/CC)
+  for o in NO_ENVIRON_ARRAY PERL_USE_SAFE_PUTENV
+  do
+    case "$ccflags" in
+    *$o*) ;;
+    *) ccflags="$ccflags $o" ;;
+    esac
+  done
+  ;;
+esac
+

==== //depot/maint-5.8/perl/mathoms.c#26 (text) ====
Index: perl/mathoms.c
--- perl/mathoms.c#25~30033~    2007-01-27 08:40:35.000000000 -0800
+++ perl/mathoms.c      2007-01-27 09:35:47.000000000 -0800
@@ -29,41 +29,42 @@
 #define PERL_IN_MATHOMS_C
 #include "perl.h"
 
-OP * Perl_ref(pTHX_ OP *o, I32 type);
-void Perl_sv_unref(pTHX_ SV *sv);
-void Perl_sv_taint(pTHX_ SV *sv);
-IV Perl_sv_2iv(pTHX_ register SV *sv);
-UV Perl_sv_2uv(pTHX_ register SV *sv);
-char * Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp);
-char * Perl_sv_2pv_nolen(pTHX_ register SV *sv);
-char * Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv);
-char * Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv);
-void Perl_sv_force_normal(pTHX_ register SV *sv);
-void Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr);
-void Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN slen);
-void Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const char *ptr, 
register STRLEN len);
-void Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr);
-void Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv);
-char * Perl_sv_pv(pTHX_ SV *sv);
-char * Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp);
-char * Perl_sv_pvbyte(pTHX_ SV *sv);
-char * Perl_sv_pvutf8(pTHX_ SV *sv);
-STRLEN Perl_sv_utf8_upgrade(pTHX_ register SV *sv);
-NV Perl_huge(void);
-void Perl_gv_fullname3(pTHX_ SV *sv, GV *gv, const char *prefix);
-void Perl_gv_efullname3(pTHX_ SV *sv, GV *gv, const char *prefix);
-GV * Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name);
-HE * Perl_hv_iternext(pTHX_ HV *hv);
-void Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how);
-bool Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
-               int rawmode, int rawperm, PerlIO *supplied_fp);
-bool Perl_do_aexec(pTHX_ SV *really, register SV **mark, register SV **sp);
-bool Perl_do_exec(pTHX_ char *cmd);
-U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv);
-bool Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **ep);
-void Perl_sv_nolocking(pTHX_ SV *sv);
-void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len);
-void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len);
+PERL_CALLCONV OP * Perl_ref(pTHX_ OP *o, I32 type);
+PERL_CALLCONV void Perl_sv_unref(pTHX_ SV *sv);
+PERL_CALLCONV void Perl_sv_taint(pTHX_ SV *sv);
+PERL_CALLCONV IV Perl_sv_2iv(pTHX_ register SV *sv);
+PERL_CALLCONV UV Perl_sv_2uv(pTHX_ register SV *sv);
+PERL_CALLCONV char * Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp);
+PERL_CALLCONV char * Perl_sv_2pv_nolen(pTHX_ register SV *sv);
+PERL_CALLCONV char * Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv);
+PERL_CALLCONV char * Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv);
+PERL_CALLCONV void Perl_sv_force_normal(pTHX_ register SV *sv);
+PERL_CALLCONV void Perl_sv_setsv(pTHX_ SV *dstr, register SV *sstr);
+PERL_CALLCONV void Perl_sv_catpvn(pTHX_ SV *dsv, const char* sstr, STRLEN 
slen);
+PERL_CALLCONV void Perl_sv_catpvn_mg(pTHX_ register SV *sv, register const 
char *ptr, register STRLEN len);
+PERL_CALLCONV void Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr);
+PERL_CALLCONV void Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv);
+PERL_CALLCONV char * Perl_sv_pv(pTHX_ SV *sv);
+PERL_CALLCONV char * Perl_sv_pvn_force(pTHX_ SV *sv, STRLEN *lp);
+PERL_CALLCONV char * Perl_sv_pvbyte(pTHX_ SV *sv);
+PERL_CALLCONV char * Perl_sv_pvutf8(pTHX_ SV *sv);
+PERL_CALLCONV STRLEN Perl_sv_utf8_upgrade(pTHX_ register SV *sv);
+PERL_CALLCONV NV Perl_huge(void);
+PERL_CALLCONV void Perl_gv_fullname3(pTHX_ SV *sv, GV *gv, const char *prefix);
+PERL_CALLCONV void Perl_gv_efullname3(pTHX_ SV *sv, GV *gv, const char 
*prefix);
+PERL_CALLCONV GV * Perl_gv_fetchmethod(pTHX_ HV *stash, const char *name);
+PERL_CALLCONV HE * Perl_hv_iternext(pTHX_ HV *hv);
+PERL_CALLCONV void Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how);
+PERL_CALLCONV bool Perl_do_open(pTHX_ GV *gv, register char *name, I32 len, 
int as_raw, int rawmode, int rawperm, PerlIO *supplied_fp);
+PERL_CALLCONV bool Perl_do_aexec(pTHX_ SV *really, register SV **mark, 
register SV **sp);
+PERL_CALLCONV bool Perl_do_exec(pTHX_ char *cmd);
+PERL_CALLCONV U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv);
+PERL_CALLCONV bool Perl_is_utf8_string_loc(pTHX_ U8 *s, STRLEN len, U8 **ep);
+PERL_CALLCONV void Perl_sv_nolocking(pTHX_ SV *sv);
+PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len);
+PERL_CALLCONV void Perl_sv_usepvn(pTHX_ SV *sv, char *ptr, STRLEN len);
+PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO *stream, const char *format, 
...);
+PERL_CALLCONV int Perl_printf_nocontext(const char *format, ...);
 
 
 /* ref() is now a macro using Perl_doref;

==== //depot/maint-5.8/perl/op.h#32 (text) ====
Index: perl/op.h
--- perl/op.h#31~29955~ 2007-01-24 10:58:36.000000000 -0800
+++ perl/op.h   2007-01-27 09:35:47.000000000 -0800
@@ -509,8 +509,9 @@
 #define PERL_LOADMOD_NOIMPORT          0x2
 #define PERL_LOADMOD_IMPORT_OPS                0x4
 
-/* used in perly.y */
+#if defined(PERL_IN_PERLY_C) || defined(PERL_IN_OP_C)
 #define ref(o, type) doref(o, type, TRUE)
+#endif
 
 /* no longer used anywhere in core */
 #ifndef PERL_CORE

==== //depot/maint-5.8/perl/perl.h#145 (text) ====
Index: perl/perl.h
--- perl/perl.h#144~30033~      2007-01-27 08:40:35.000000000 -0800
+++ perl/perl.h 2007-01-27 09:35:47.000000000 -0800
@@ -280,10 +280,18 @@
  * PERL_CALLCONV to be something special.  See also the
  * definition of XS() in XSUB.h. */
 #ifndef PERL_EXPORT_C
-#  define PERL_EXPORT_C extern
+#  ifdef __cplusplus
+#    define PERL_EXPORT_C extern "C"
+#  else
+#    define PERL_EXPORT_C extern
+#  endif
 #endif
 #ifndef PERL_XS_EXPORT_C
-#  define PERL_XS_EXPORT_C
+#  ifdef __cplusplus
+#    define PERL_XS_EXPORT_C extern "C"
+#  else
+#    define PERL_XS_EXPORT_C
+#  endif
 #endif
 
 #ifdef OP_IN_REGISTER
@@ -527,11 +535,11 @@
 #endif
 
 #if defined(HAS_SYSCALL) && !defined(HAS_SYSCALL_PROTO) && !defined(PERL_MICRO)
-int syscall(int, ...);
+EXTERN_C int syscall(int, ...);
 #endif
 
 #if defined(HAS_USLEEP) && !defined(HAS_USLEEP_PROTO) && !defined(PERL_MICRO)
-int usleep(unsigned int);
+EXTERN_C int usleep(unsigned int);
 #endif
 
 #ifdef PERL_MICRO /* Last chance to export Perl_my_swap */
@@ -1075,6 +1083,10 @@
 # endif
 #endif
 
+#if defined(__SUNPRO_CC)
+EXTERN_C char *crypt(const char *, const char *);
+#endif
+
 #ifdef SETERRNO
 # undef SETERRNO  /* SOCKS might have defined this */
 #endif
@@ -4336,7 +4348,11 @@
 #include "pp.h"
 
 #ifndef PERL_CALLCONV
-#  define PERL_CALLCONV
+#  ifdef __cplusplus
+#    define PERL_CALLCONV extern "C"
+#  else
+#    define PERL_CALLCONV
+#  endif
 #endif
 #undef PERL_CKDEF
 #undef PERL_PPDEF

==== //depot/maint-5.8/perl/perlio.c#96 (text) ====
Index: perl/perlio.c
--- perl/perlio.c#95~29997~     2007-01-26 02:30:23.000000000 -0800
+++ perl/perlio.c       2007-01-27 09:35:47.000000000 -0800
@@ -113,6 +113,9 @@
                SETERRNO(EBADF, SS_IVCHAN)
 
 #ifndef USE_SFIO
+
+EXTERN_C int perlsio_binmode(FILE *fp, int iotype, int mode);
+
 int
 perlsio_binmode(FILE *fp, int iotype, int mode)
 {
@@ -4561,7 +4564,14 @@
     if (m->len) {
        PerlIOBuf * const b = &m->base;
        if (b->buf) {
-           code = munmap(m->mptr, m->len);
+           /* The munmap address argument is tricky: depending on the
+            * standard it is either "void *" or "caddr_t" (which is
+            * usually "char *" (signed or unsigned).  If we cast it
+            * to "void *", those that have it caddr_t and an uptight
+            * C++ compiler, will freak out.  But casting it as char*
+            * should work.  Maybe.  (Using Mmap_t figured out by
+            * Configure doesn't always work, apparently.) */
+           code = munmap((char*)m->mptr, m->len);
            b->buf = NULL;
            m->len = 0;
            m->mptr = NULL;

==== //depot/maint-5.8/perl/sv.c#327 (text) ====
Index: perl/sv.c
--- perl/sv.c#326~30033~        2007-01-27 08:40:35.000000000 -0800
+++ perl/sv.c   2007-01-27 09:35:47.000000000 -0800
@@ -1066,8 +1066,8 @@
     STMT_START { \
        void ** const r3wt = &PL_body_roots[sv_type]; \
        LOCK_SV_MUTEX; \
-       xpv = *((void **)(r3wt)) \
-         ? *((void **)(r3wt)) : more_bodies(sv_type); \
+       xpv = (PTR_TBL_ENT_t*) (*((void **)(r3wt))      \
+         ? *((void **)(r3wt)) : more_bodies(sv_type)); \
        *(r3wt) = *(void**)(xpv); \
        UNLOCK_SV_MUTEX; \
     } STMT_END
@@ -9886,7 +9886,7 @@
            break;
         case SAVEt_HV:                         /* hash reference */
         case SAVEt_AV:                         /* array reference */
-           sv = POPPTR(ss,ix);
+           sv = (SV*) POPPTR(ss,ix);
            TOPPTR(nss,ix) = sv_dup_inc(sv, param);
            /* fall through */
        case SAVEt_COMPPAD:
@@ -10070,13 +10070,14 @@
                new_state->re_state_regeol
                    = pv_dup(old_state->re_state_regeol);
                new_state->re_state_regstartp
-                   = any_dup(old_state->re_state_regstartp, proto_perl);
+                   = (I32*) any_dup(old_state->re_state_regstartp, proto_perl);
                new_state->re_state_regendp
-                   = any_dup(old_state->re_state_regendp, proto_perl);
+                   = (I32*) any_dup(old_state->re_state_regendp, proto_perl);
                new_state->re_state_reglastparen
-                   = any_dup(old_state->re_state_reglastparen, proto_perl);
+                   = (U32*) any_dup(old_state->re_state_reglastparen, 
+                             proto_perl);
                new_state->re_state_reglastcloseparen
-                   = any_dup(old_state->re_state_reglastcloseparen,
+                   = (U32*)any_dup(old_state->re_state_reglastcloseparen,
                              proto_perl);
                new_state->re_state_regtill
                    = pv_dup(old_state->re_state_regtill);
@@ -10106,11 +10107,14 @@
                    = sv_dup(old_state->re_state_nrs, param);
 #endif
                new_state->re_state_reg_magic
-                   = any_dup(old_state->re_state_reg_magic, proto_perl);
+                   = (MAGIC*) any_dup(old_state->re_state_reg_magic, 
+                              proto_perl);
                new_state->re_state_reg_oldcurpm
-                   = any_dup(old_state->re_state_reg_oldcurpm, proto_perl);
+                   = (PMOP*) any_dup(old_state->re_state_reg_oldcurpm, 
+                             proto_perl);
                new_state->re_state_reg_curpm
-                   = any_dup(old_state->re_state_reg_curpm, proto_perl);
+                   = (PMOP*)  any_dup(old_state->re_state_reg_curpm, 
+                              proto_perl);
                new_state->re_state_reg_oldsaved
                    = pv_dup(old_state->re_state_reg_oldsaved);
                new_state->re_state_reg_poscache
@@ -10795,7 +10799,7 @@
 
     PL_glob_index      = proto_perl->Iglob_index;
     PL_srand_called    = proto_perl->Isrand_called;
-    PL_uudmap['M']     = 0;            /* reinits on demand */
+    PL_uudmap[(U32) 'M']       = 0;    /* reinits on demand */
     PL_bitcount                = NULL; /* reinits on demand */
 
     if (proto_perl->Ipsig_pend) {

==== //depot/maint-5.8/perl/unixish.h#10 (text) ====
Index: perl/unixish.h
--- perl/unixish.h#9~21926~     2003-12-18 12:49:11.000000000 -0800
+++ perl/unixish.h      2007-01-27 09:35:47.000000000 -0800
@@ -138,5 +138,7 @@
 
 #define dXSUB_SYS
 
+#ifndef NO_ENVIRON_ARRAY
 #define USE_ENVIRON_ARRAY
+#endif
 

==== //depot/maint-5.8/perl/utf8.c#75 (text) ====
Index: perl/utf8.c
--- perl/utf8.c#74~30033~       2007-01-27 08:40:35.000000000 -0800
+++ perl/utf8.c 2007-01-27 09:35:47.000000000 -0800
@@ -25,6 +25,13 @@
 #define PERL_IN_UTF8_C
 #include "perl.h"
 
+#ifndef EBCDIC
+/* Separate prototypes needed because in ASCII systems these
+ * usually macros but they still are compiled as code, too. */
+PERL_CALLCONV UV       Perl_utf8n_to_uvchr(pTHX_ U8 *s, STRLEN curlen, STRLEN 
*retlen, U32 flags);
+PERL_CALLCONV U8*      Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv);
+#endif
+
 static const char unees[] =
     "Malformed UTF-8 character (unexpected end of string)";
 
@@ -2209,7 +2216,7 @@
      register const U8 *p1  = (const U8*)s1;
      register const U8 *p2  = (const U8*)s2;
      register const U8 *f1 = NULL;
-     register U8 *f2 = NULL;
+     register const U8 *f2 = NULL;
      register U8 *e1 = NULL;
      register U8 *q1 = NULL;
      register U8 *e2 = NULL;

==== //depot/maint-5.8/perl/util.c#136 (text) ====
Index: perl/util.c
--- perl/util.c#135~30033~      2007-01-27 08:40:35.000000000 -0800
+++ perl/util.c 2007-01-27 09:35:47.000000000 -0800
@@ -1546,46 +1546,46 @@
 #ifndef PERL_USE_SAFE_PUTENV
     if (!PL_use_safe_putenv) {
     /* most putenv()s leak, so we manipulate environ directly */
-    register I32 i=setenv_getix(nam);          /* where does it go? */
+    register I32 i=setenv_getix(nam);          /* where does it go? */
     int nlen, vlen;
 
-    if (environ == PL_origenviron) {   /* need we copy environment? */
-       I32 j;
-       I32 max;
-       char **tmpenv;
-
-       max = i;
-       while (environ[max])
-           max++;
-       tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*));
-       for (j=0; j<max; j++) {         /* copy environment */
-           const int len = strlen(environ[j]);
-           tmpenv[j] = (char*)safesysmalloc((len+1)*sizeof(char));
-           Copy(environ[j], tmpenv[j], len+1, char);
-       }
-       tmpenv[max] = NULL;
-       environ = tmpenv;               /* tell exec where it is now */
+    if (environ == PL_origenviron) {   /* need we copy environment? */
+       I32 j;
+       I32 max;
+       char **tmpenv;
+
+       max = i;
+       while (environ[max])
+           max++;
+       tmpenv = (char**)safesysmalloc((max+2) * sizeof(char*));
+       for (j=0; j<max; j++) {         /* copy environment */
+           const int len = strlen(environ[j]);
+           tmpenv[j] = (char*)safesysmalloc((len+1)*sizeof(char));
+           Copy(environ[j], tmpenv[j], len+1, char);
+       }
+       tmpenv[max] = NULL;
+       environ = tmpenv;               /* tell exec where it is now */
     }
     if (!val) {
-       safesysfree(environ[i]);
-       while (environ[i]) {
-           environ[i] = environ[i+1];
-           i++;
-       }
-       return;
-    }
-    if (!environ[i]) {                 /* does not exist yet */
-       environ = (char**)safesysrealloc(environ, (i+2) * sizeof(char*));
-       environ[i+1] = NULL;    /* make sure it's null terminated */
+       safesysfree(environ[i]);
+       while (environ[i]) {
+           environ[i] = environ[i+1];
+           i++;
+       }
+       return;
+    }
+    if (!environ[i]) {                 /* does not exist yet */
+       environ = (char**)safesysrealloc(environ, (i+2) * sizeof(char*));
+       environ[i+1] = NULL;    /* make sure it's null terminated */
     }
     else
-       safesysfree(environ[i]);
-    nlen = strlen(nam);
-    vlen = strlen(val);
-
-    environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char));
-    /* all that work just for this */
-    my_setenv_format(environ[i], nam, nlen, val, vlen);
+       safesysfree(environ[i]);
+       nlen = strlen(nam);
+       vlen = strlen(val);
+
+       environ[i] = (char*)safesysmalloc((nlen+vlen+2) * sizeof(char));
+       /* all that work just for this */
+       my_setenv_format(environ[i], nam, nlen, val, vlen);
     } else {
 # endif
 #   if defined(__CYGWIN__) || defined(EPOC) || defined(SYMBIAN) 
@@ -1640,7 +1640,7 @@
     int vlen;
 
     if (!val) {
-       val = "";
+       val = "";
     }
     vlen = strlen(val);
     Newx(envstr, nlen+vlen+2, char);

==== //depot/maint-5.8/perl/x2p/EXTERN.h#6 (text) ====
Index: perl/x2p/EXTERN.h
--- perl/x2p/EXTERN.h#5~26609~  2006-01-03 08:16:33.000000000 -0800
+++ perl/x2p/EXTERN.h   2007-01-27 09:35:47.000000000 -0800
@@ -9,6 +9,12 @@
 #undef EXT
 #define EXT extern
 
+#ifdef __cplusplus
+#  define EXTERN_C extern "C"
+#else
+#  define EXTERN_C extern
+#endif
+
 #undef INIT
 #define INIT(x)
 

==== //depot/maint-5.8/perl/x2p/INTERN.h#6 (text) ====
Index: perl/x2p/INTERN.h
--- perl/x2p/INTERN.h#5~26609~  2006-01-03 08:16:33.000000000 -0800
+++ perl/x2p/INTERN.h   2007-01-27 09:35:47.000000000 -0800
@@ -9,6 +9,14 @@
 #undef EXT
 #define EXT
 
+#ifdef __cplusplus
+#  define EXTERN_C extern "C"
+#else
+#  ifndef EXTERN_C
+#    define EXTERN_C
+#  endif
+#endif
+
 #undef INIT
 #define INIT(x) = x
 

==== //depot/maint-5.8/perl/x2p/hash.h#6 (text) ====
Index: perl/x2p/hash.h
--- perl/x2p/hash.h#5~26609~    2006-01-03 08:16:33.000000000 -0800
+++ perl/x2p/hash.h     2007-01-27 09:35:47.000000000 -0800
@@ -10,7 +10,7 @@
 #define FILLPCT 60             /* don't make greater than 99 */
 
 #ifdef DOINIT
-char const coeff[] = {
+EXTERN_C char const coeff[] = {
                61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
                61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
                61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
@@ -20,7 +20,7 @@
                61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
                61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
 #else
-extern const char coeff[];
+EXTERN_C const char coeff[];
 #endif
 
 typedef struct hentry HENT;
End of Patch.

Reply via email to