From b534d61c82722c28ccc38c924e67fd140b94dd37 Mon Sep 17 00:00:00 2001 From: Jeroen Ruigrok/asmodai Date: Sun, 18 Sep 2005 11:36:08 +0000 Subject: [PATCH] Synchronise with FreeBSD: make printlink()'s FTSENT parameter const, it doesn't get modified at all during the function call, reflect that. Use the unit_t typedef for the unitp array. Use u_int for unit_sz as other unsigned integers do. Cast ilogb()'s return value to u_int to match unit_sz (ilogb() returns an int). Cast UNIT_MAX to u_int because enum types are int. --- bin/ls/print.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/ls/print.c b/bin/ls/print.c index d8ef2c9901..636dc53535 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -31,7 +31,7 @@ * * @(#)print.c 8.4 (Berkeley) 4/17/94 * $FreeBSD: src/bin/ls/print.c,v 1.63 2002/11/06 01:18:12 tjr Exp $ - * $DragonFly: src/bin/ls/print.c,v 1.11 2005/09/18 11:07:38 asmodai Exp $ + * $DragonFly: src/bin/ls/print.c,v 1.12 2005/09/18 11:36:08 asmodai Exp $ */ #include @@ -57,7 +57,7 @@ #include "extern.h" static int printaname(FTSENT *, u_long, u_long); -static void printlink(FTSENT *); +static void printlink(const FTSENT *); static void printtime(time_t); static int printtype(u_int); static void printsize(size_t, off_t); @@ -87,7 +87,7 @@ typedef enum { } unit_t; static unit_t unit_adjust(off_t *); -static int unitp[] = {NONE, KILO, MEGA, GIGA, TERA, PETA}; +static unit_t unitp[] = {NONE, KILO, MEGA, GIGA, TERA, PETA}; #ifdef COLORLS /* Most of these are taken from */ @@ -573,7 +573,7 @@ colorquit(int sig) #endif /* COLORLS */ static void -printlink(FTSENT *p) +printlink(const FTSENT *p) { int lnklen; char name[MAXPATHLEN + 1]; @@ -621,13 +621,13 @@ unit_adjust(off_t *val) { double abval; unit_t unit; - unsigned int unit_sz; + u_int unit_sz; abval = fabs((double)*val); - unit_sz = abval ? ilogb(abval) / 10 : 0; + unit_sz = abval ? (u_int)ilogb(abval) / 10 : 0; - if (unit_sz >= UNIT_MAX) { + if (unit_sz >= (u_int)UNIT_MAX) { unit = NONE; } else { unit = unitp[unit_sz]; -- 2.41.0