summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2018-01-31 09:14:40 +0000
committerPeter Stephenson <pws@zsh.org>2018-01-31 09:14:40 +0000
commit2cbf6b6a19716cd4f03c820929710499576aa809 (patch)
tree00e4ebe379b3d670bea164665f9b0af1c3bc92ae /Src/builtin.c
parentf62af4a7efd223d7dd5459ca0969fa94470cf39c (diff)
downloadzsh-2cbf6b6a19716cd4f03c820929710499576aa809.tar.gz
zsh-2cbf6b6a19716cd4f03c820929710499576aa809.tar.xz
zsh-2cbf6b6a19716cd4f03c820929710499576aa809.zip
42332: Special case unsigned printf formats.
For constants we can avoid a conversion to signed by examining
the expression before passing to math eval.
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 0211f2721..fb59738f3 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5243,7 +5243,10 @@ bin_print(char *name, char **args, Options ops, int func)
  		    	*d++ = 'l';
 #endif
 		    	*d++ = 'l', *d++ = *c, *d = '\0';
-			zulongval = (curarg) ? mathevali(curarg) : 0;
+			if (!curarg)
+			    zulongval = (zulong)0;
+			else if (!zstrtoul_underscore(curarg, &zulongval))
+			    zulongval = mathevali(curarg);
 			if (errflag) {
 			    zulongval = 0;
 			    errflag &= ~ERRFLAG_ERROR;