Nicholas Marriott wrote:
> Works for me. ok anyone?
>
> I think ksh_limval.h can go entirely after this, per the note in
> PROJECTS.
I also just found this gem. It only has one use, so it can probably be
replaced. Am I interpreting it correctly?
Index: shf.c
===================================================================
RCS file: /cvs/src/bin/ksh/shf.c,v
retrieving revision 1.16
diff -u -p -r1.16 shf.c
--- shf.c 19 Apr 2013 17:36:09 -0000 1.16
+++ shf.c 13 Sep 2015 00:42:51 -0000
@@ -715,21 +715,6 @@ shf_smprintf(const char *fmt, ...)
* constant, just use a large buffer.
*/
-/*
- * What kinda of machine we on? Hopefully the C compiler will optimize
- * this out...
- *
- * For shorts, we want sign extend for %d but not for %[oxu] - on 16 bit
- * machines it don't matter. Assumes C compiler has converted shorts to
- * ints before pushing them.
- */
-#define POP_INT(f, s, a) \
- (((f) & FL_LLONG) ? va_arg((a), unsigned long long) : \
- ((f) & FL_LONG) ? va_arg((a), unsigned long) : \
- (sizeof(int) < sizeof(long) ? ((s) ? \
- (long) va_arg((a), int) : va_arg((a), unsigned)) : \
- va_arg((a), unsigned)))
-
#define ABIGNUM 32000 /* big numer that will fit in a short */
#define LOG2_10 3.321928094887362347870319429 /* log base 2
of 10 */
@@ -890,7 +875,7 @@ shf_vfprintf(struct shf *shf, const char
case 'x':
flags |= FL_NUMBER;
s = &numbuf[sizeof(numbuf)];
- llnum = POP_INT(flags, c == 'd', args);
+ llnum = va_arg(args, unsigned long long);
switch (c) {
case 'd':
case 'i':