ext/ consting
authorRobin Barker <RMBarker@cpan.org>
Sat, 22 Dec 2007 00:39:47 +0000 (00:39 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 22 Dec 2007 16:17:01 +0000 (16:17 +0000)
From: "Robin Barker" <Robin.Barker@npl.co.uk>
Message-ID: <46A0F33545E63740BC7563DE59CA9C6D09399D@exchsvr2.npl.ad.local>
Date: Sat, 22 Dec 2007 00:39:47 -0000

p4raw-id: //depot/perl@32703

23 files changed:
ext/Devel/Peek/Peek.xs
ext/DynaLoader/dl_aix.xs
ext/DynaLoader/dl_beos.xs
ext/DynaLoader/dl_dld.xs
ext/DynaLoader/dl_dllload.xs
ext/DynaLoader/dl_dlopen.xs
ext/DynaLoader/dl_dyld.xs
ext/DynaLoader/dl_hpux.xs
ext/DynaLoader/dl_mac.xs
ext/DynaLoader/dl_mpeix.xs
ext/DynaLoader/dl_next.xs
ext/DynaLoader/dl_symbian.xs
ext/DynaLoader/dl_vmesa.xs
ext/DynaLoader/dl_vms.xs
ext/GDBM_File/typemap
ext/IPC/SysV/SysV.xs
ext/POSIX/POSIX.xs
ext/PerlIO/via/via.xs
ext/SDBM_File/sdbm/hash.c
ext/SDBM_File/sdbm/pair.c
ext/SDBM_File/sdbm/sdbm.h
ext/Socket/Socket.xs
ext/re/re.xs

index f07c2e5..cf47c3c 100644 (file)
@@ -321,7 +321,7 @@ MODULE = Devel::Peek                PACKAGE = Devel::Peek
 
 void
 mstat(str="Devel::Peek::mstat: ")
-char *str
+const char *str
 
 void
 fill_mstats(SV *sv, int level = 0)
index 8529097..c91a2fc 100644 (file)
@@ -744,7 +744,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *     perl_name
     void *     symref 
-    char *     filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%x)\n",
        perl_name, symref));
index ae40269..3453d68 100644 (file)
@@ -98,7 +98,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *             perl_name
     void *             symref 
-    char *             filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%lx)\n",
                perl_name, (unsigned long) symref));
index 127c0d1..ab72ca3 100644 (file)
@@ -169,7 +169,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *     perl_name
     void *     symref 
-    char *     filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%x)\n",
            perl_name, symref));
index c5ce35a..61611d7 100644 (file)
@@ -170,7 +170,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *             perl_name
     void *             symref 
-    char *             filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%lx)\n",
                perl_name, (unsigned long) symref));
index 83f5aed..3332758 100644 (file)
@@ -246,7 +246,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *             perl_name
     void *             symref 
-    char *             filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%"UVxf")\n",
                perl_name, PTR2UV(symref)));
index eac0408..c8f999b 100644 (file)
@@ -201,7 +201,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *     perl_name
     void *     symref
-    char *     filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%x)\n",
            perl_name, symref));
index 0c751dd..f85dea1 100644 (file)
@@ -160,7 +160,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *     perl_name
     void *     symref 
-    char *     filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%x)\n",
            perl_name, symref));
index 826caf2..474cd99 100644 (file)
@@ -126,7 +126,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *             perl_name
     void *             symref 
-    char *             filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_install_xsub(name=%s, symref=%x)\n",
                perl_name, symref));
index 4b339c5..a73e22a 100644 (file)
@@ -111,7 +111,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *      perl_name
     void *      symref
-    char *      filename
+    const char *      filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log,"dl_install_xsub(name=%s, symref=%x)\n",
             perl_name, symref));
index e61c800..a7742a1 100644 (file)
@@ -301,7 +301,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *     perl_name
     void *     symref 
-    char *     filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%x)\n",
            perl_name, symref));
index b2f2732..f7ddc09 100644 (file)
@@ -205,7 +205,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *             perl_name
     void *             symref 
-    char *             filename
+    const char *       filename
     CODE:
     ST(0) = sv_2mortal(newRV((SV*)newXS_flags(perl_name,
                                              (void(*)(pTHX_ CV *))symref,
index 8b0d756..606c89e 100644 (file)
@@ -156,7 +156,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *             perl_name
     void *             symref
-    char *             filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%lx)\n",
                perl_name, (unsigned long) symref));
index e476663..3ae76b8 100644 (file)
@@ -367,7 +367,7 @@ void
 dl_install_xsub(perl_name, symref, filename="$Package")
     char *     perl_name
     void *     symref 
-    char *     filename
+    const char *       filename
     CODE:
     DLDEBUG(2,PerlIO_printf(Perl_debug_log, "dl_install_xsub(name=%s, symref=%x)\n",
         perl_name, symref));
index 8c7cb45..3e69721 100644 (file)
@@ -37,7 +37,8 @@ T_DATUM_V
            $var.dsize = (int)PL_na;
        }
        else {
-           $var.dptr = \"\";
+           $var.dptr = (char *)\"\";   
+           /* better would be for .dptr to be const char * */
            $var.dsize = 0;
        }
 OUTPUT
index deaa8e8..b5137cf 100644 (file)
@@ -222,7 +222,7 @@ BOOT:
     /*
      * constant subs for IPC::SysV
      */
-     struct { char *n; I32 v; } IPC__SysV__const[] = {
+     struct { const char *n; I32 v; } IPC__SysV__const[] = {
 #ifdef GETVAL
         {"GETVAL", GETVAL},
 #endif
@@ -434,7 +434,7 @@ BOOT:
         {"S_IRWXO", S_IRWXO},
 #endif
        {Nullch,0}};
-    char *name;
+    const char *name;
     int i;
 
     for(i = 0 ; (name = IPC__SysV__const[i].n) ; i++) {
index 9ddfd3a..867d35b 100644 (file)
@@ -582,7 +582,7 @@ MODULE = SigSet             PACKAGE = POSIX::SigSet         PREFIX = sig
 
 POSIX::SigSet
 new(packname = "POSIX::SigSet", ...)
-    char *             packname
+    const char *       packname
     CODE:
        {
            int i;
@@ -627,7 +627,7 @@ MODULE = Termios    PACKAGE = POSIX::Termios        PREFIX = cf
 
 POSIX::Termios
 new(packname = "POSIX::Termios", ...)
-    char *             packname
+    const char *       packname
     CODE:
        {
 #ifdef I_TERMIOS
index 5670887..b17108c 100644 (file)
@@ -41,7 +41,7 @@ typedef struct
 #define MYMethod(x) #x,&s->x
 
 CV *
-PerlIOVia_fetchmethod(pTHX_ PerlIOVia * s, char *method, CV ** save)
+PerlIOVia_fetchmethod(pTHX_ PerlIOVia * s, const char *method, CV ** save)
 {
     GV *gv = gv_fetchmeth(s->stash, method, strlen(method), 0);
 #if 0
@@ -64,7 +64,7 @@ PerlIOVia_fetchmethod(pTHX_ PerlIOVia * s, char *method, CV ** save)
  */
 
 SV *
-PerlIOVia_method(pTHX_ PerlIO * f, char *method, CV ** save, int flags,
+PerlIOVia_method(pTHX_ PerlIO * f, const char *method, CV ** save, int flags,
                 ...)
 {
     PerlIOVia *s = PerlIOSelf(f, PerlIOVia);
index 9b27648..7dd1c99 100644 (file)
@@ -18,7 +18,7 @@
  *      65587   even better. 
  */
 long
-sdbm_hash(register char *str, register int len)
+sdbm_hash(register const char *str, register int len)
 {
        register unsigned long n = 0;
 
index 4f0fde2..42b130d 100644 (file)
@@ -22,7 +22,7 @@
 /* 
  * forward 
  */
-static int seepair proto((char *, int, char *, int));
+static int seepair proto((char *, int, const char *, int));
 
 /*
  * page format:
@@ -218,7 +218,7 @@ delpair(char *pag, datum key)
  * return 0 if not found.
  */
 static int
-seepair(char *pag, register int n, register char *key, register int siz)
+seepair(char *pag, register int n, register const char *key, register int siz)
 {
        register int i;
        register int off = PBLKSIZ;
index 88e4b66..53fc366 100644 (file)
@@ -47,7 +47,7 @@ typedef struct {
 #define sdbm_pagfno(db)        ((db)->pagf)
 
 typedef struct {
-       char *dptr;
+       const char *dptr;
        int dsize;
 } datum;
 
@@ -85,7 +85,7 @@ extern int sdbm_exists proto((DBM *, datum));
  * other
  */
 extern DBM *sdbm_prep proto((char *, char *, int, int));
-extern long sdbm_hash proto((char *, int));
+extern long sdbm_hash proto((const char *, int));
 
 #ifndef SDBM_ONLY
 #define dbm_open sdbm_open
index f86c5ae..076297f 100644 (file)
@@ -182,7 +182,7 @@ my_inet_aton(register const char *cp, struct in_addr *addr)
 
 
 static int
-not_here(char *s)
+not_here(const char *s)
 {
     croak("Socket::%s not implemented on this architecture", s);
     return -1;
index b4d3e34..d1001c4 100644 (file)
@@ -105,7 +105,7 @@ PPCODE:
                modifiers" in this scenario. 
             */
 
-            char *fptr = INT_PAT_MODS;
+            const char *fptr = INT_PAT_MODS;
             char ch;
             U16 match_flags = (U16)((re->extflags & PMf_COMPILETIME) >> 12);