This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add editor boilerplates to all C files
[perl5.git] / util.c
diff --git a/util.c b/util.c
index db56204..03201dd 100644 (file)
--- a/util.c
+++ b/util.c
@@ -2710,7 +2710,7 @@ Perl_repeatcpy(pTHX_ register char *to, register const char *from, I32 len, regi
 
 #ifndef HAS_RENAME
 I32
-Perl_same_dirent(pTHX_ char *a, char *b)
+Perl_same_dirent(pTHX_ const char *a, const char *b)
 {
     char *fa = strrchr(a,'/');
     char *fb = strrchr(b,'/');
@@ -3354,8 +3354,9 @@ Perl_init_tm(pTHX_ struct tm *ptm)        /* see mktime, strftime and asctime */
 {
 #ifdef HAS_TM_TM_ZONE
     Time_t now;
+    struct tm* my_tm;
     (void)time(&now);
-    struct tm* my_tm = localtime(&now);
+    my_tm = localtime(&now);
     if (my_tm)
         Copy(my_tm, ptm, 1, struct tm);
 #endif
@@ -3681,8 +3682,7 @@ Perl_getcwd_sv(pTHX_ register SV *sv)
         * size from the heap if they are given a NULL buffer pointer.
         * The problem is that this behaviour is not portable. */
        if (getcwd(buf, sizeof(buf) - 1)) {
-           STRLEN len = strlen(buf);
-           sv_setpvn(sv, buf, len);
+           sv_setpvn(sv, buf, strlen(buf));
            return TRUE;
        }
        else {
@@ -3695,8 +3695,7 @@ Perl_getcwd_sv(pTHX_ register SV *sv)
 
     Stat_t statbuf;
     int orig_cdev, orig_cino, cdev, cino, odev, oino, tdev, tino;
-    int namelen, pathlen=0;
-    DIR *dir;
+    int pathlen=0;
     Direntry_t *dp;
 
     (void)SvUPGRADE(sv, SVt_PV);
@@ -3711,6 +3710,7 @@ Perl_getcwd_sv(pTHX_ register SV *sv)
     cino = orig_cino;
 
     for (;;) {
+       DIR *dir;
        odev = cdev;
        oino = cino;
 
@@ -3733,9 +3733,9 @@ Perl_getcwd_sv(pTHX_ register SV *sv)
 
        while ((dp = PerlDir_read(dir)) != NULL) {
 #ifdef DIRNAMLEN
-           namelen = dp->d_namlen;
+           const int namelen = dp->d_namlen;
 #else
-           namelen = strlen(dp->d_name);
+           const int namelen = strlen(dp->d_name);
 #endif
            /* skip . and .. */
            if (SV_CWD_ISDOT(dp)) {
@@ -4353,7 +4353,7 @@ S_socketpair_udp (int fd[2]) {
     errno = ECONNABORTED;
   tidy_up_and_fail:
     {
-       int save_errno = errno;
+       const int save_errno = errno;
        if (sockets[0] != -1)
            PerlLIO_close(sockets[0]);
        if (sockets[1] != -1)
@@ -4722,6 +4722,11 @@ Perl_init_global_struct(pTHX)
 #  else
     plvarsp = PL_VarsPtr;
 #  endif /* PERL_GLOBAL_STRUCT_PRIVATE */
+#  undef PERLVAR
+#  undef PERLVARA
+#  undef PERLVARI
+#  undef PERLVARIC
+#  undef PERLVARISC
 #  define PERLVAR(var,type) /**/
 #  define PERLVARA(var,n,type) /**/
 #  define PERLVARI(var,type,init) plvarsp->var = init;
@@ -4772,3 +4777,12 @@ Perl_free_global_struct(pTHX_ struct perl_vars *plvarsp)
 
 #endif /* PERL_GLOBAL_STRUCT */
 
+/*
+ * Local variables:
+ * c-indentation-style: bsd
+ * c-basic-offset: 4
+ * indent-tabs-mode: t
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 noet:
+*/