This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Now that we have the full path, we can skip the which call,
[perl5.git] / universal.c
index 525ae44..adff0ff 100644 (file)
@@ -1,7 +1,7 @@
 /*    universal.c
  *
  *    Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- *    by Larry Wall and others
+ *    2005, by Larry Wall and others
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -137,7 +137,7 @@ for class names as well as for objects.
 bool
 Perl_sv_derived_from(pTHX_ SV *sv, const char *name)
 {
-    char *type;
+    const char *type;
     HV *stash;
     HV *name_stash;
 
@@ -199,7 +199,7 @@ XS(XS_Internals_HvREHASH);
 void
 Perl_boot_core_UNIVERSAL(pTHX)
 {
-    char *file = __FILE__;
+    const char file[] = __FILE__;
 
     newXS("UNIVERSAL::isa",             XS_UNIVERSAL_isa,         file);
     newXS("UNIVERSAL::can",             XS_UNIVERSAL_can,         file);
@@ -320,7 +320,7 @@ XS(XS_UNIVERSAL_VERSION)
     GV **gvp;
     GV *gv;
     SV *sv;
-    char *undef;
+    const char *undef;
 
     if (SvROK(ST(0))) {
         sv = (SV*)SvRV(ST(0));
@@ -357,7 +357,7 @@ XS(XS_UNIVERSAL_VERSION)
                             "%s does not define $%s::VERSION--version check failed",
                             HvNAME(pkg), HvNAME(pkg));
             else {
-                 char *str = SvPVx(ST(0), len);
+                  const char *str = SvPVx(ST(0), len);
 
                  Perl_croak(aTHX_
                             "%s defines neither package nor VERSION--version check failed", str);
@@ -394,7 +394,7 @@ XS(XS_version_new)
        Perl_croak(aTHX_ "Usage: version::new(class, version)");
     SP -= items;
     {
-       char *  class = (char *)SvPV_nolen(ST(0));
+        const char *class = SvPV_nolen(ST(0));
         SV *vs = ST(1);
        SV *rv;
        if (items == 3 )
@@ -602,7 +602,7 @@ XS(XS_version_qv)
            }
            else
            {
-               version = savepv(SvPV_nolen(ver));
+               version = savesvpv(ver);
            }
            (void)scan_version(version,vs,TRUE);
            Safefree(version);
@@ -955,3 +955,13 @@ XS(XS_Internals_HvREHASH)  /* Subject to change  */
     }
     Perl_croak(aTHX_ "Internals::HvREHASH $hashref");
 }
+
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vim: shiftwidth=4:
+*/