about summary refs log tree commit diff
path: root/Src/Modules/parameter.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-03-05 10:06:28 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-03-05 10:06:28 +0000
commit86f8e8de696404b85c334916bfe3d69bdd4291c6 (patch)
treea37c7c91bfe9f5b92bf574e56009ff86f49e3f0f /Src/Modules/parameter.c
parent7614be7fe1b9a9692a6c8f5c5f471df3ef288366 (diff)
downloadzsh-86f8e8de696404b85c334916bfe3d69bdd4291c6.tar.gz
zsh-86f8e8de696404b85c334916bfe3d69bdd4291c6.tar.xz
zsh-86f8e8de696404b85c334916bfe3d69bdd4291c6.zip
30307 plus tweak suggsted by Wayne: use %lld for zlong when long long
Diffstat (limited to 'Src/Modules/parameter.c')
-rw-r--r--Src/Modules/parameter.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 092efa0c3..4d29ba635 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -531,7 +531,11 @@ functracegetfn(UNUSED(Param pm))
 	char *colonpair;
 
 	colonpair = zhalloc(strlen(f->caller) + (f->lineno > 9999 ? 24 : 6));
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+	sprintf(colonpair, "%s:%lld", f->caller, f->lineno);
+#else
 	sprintf(colonpair, "%s:%ld", f->caller, (long)f->lineno);
+#endif
 
 	*p = colonpair;
     }
@@ -559,7 +563,11 @@ funcsourcetracegetfn(UNUSED(Param pm))
 	char *fname = f->filename ? f->filename : "";
 
 	colonpair = zhalloc(strlen(fname) + (f->flineno > 9999 ? 24 : 6));
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+	sprintf(colonpair, "%s:%lld", fname, f->flineno);
+#else
 	sprintf(colonpair, "%s:%ld", fname, (long)f->flineno);
+#endif
 
 	*p = colonpair;
     }
@@ -594,7 +602,11 @@ funcfiletracegetfn(UNUSED(Param pm))
 	     */
 	    colonpair = zhalloc(strlen(f->caller) +
 				(f->lineno > 9999 ? 24 : 6));
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+	    sprintf(colonpair, "%s:%lld", f->caller, f->lineno);
+#else
 	    sprintf(colonpair, "%s:%ld", f->caller, (long)f->lineno);
+#endif
 	} else {
 	    /*
 	     * Calling context is a function or eval; we need to find
@@ -604,7 +616,7 @@ funcfiletracegetfn(UNUSED(Param pm))
 	     * together with the $functrace line number for the current
 	     * context.
 	     */
-	    long flineno = (long)(f->prev->flineno + f->lineno);
+	    zlong flineno = f->prev->flineno + f->lineno;
 	    /*
 	     * Line numbers in eval start from 1, not zero,
 	     * so offset by one to get line in file.
@@ -614,7 +626,11 @@ funcfiletracegetfn(UNUSED(Param pm))
 	    fname = f->prev->filename ? f->prev->filename : "";
 
 	    colonpair = zhalloc(strlen(fname) + (flineno > 9999 ? 24 : 6));
-	    sprintf(colonpair, "%s:%ld", fname, flineno);
+#if defined(ZLONG_IS_LONG_LONG) && defined(PRINTF_HAS_LLD)
+	    sprintf(colonpair, "%s:%lld", fname, flineno);
+#else
+	    sprintf(colonpair, "%s:%ld", fname, (long)flineno);
+#endif
 	}
 
 	*p = colonpair;