Assorted trivial optimizations

   text	   data	    bss	    dec	    hex	filename
 236448	    672	  19044	 256164	  3e8a4	strace.before
 236360	    672	  19044	 256076	  3e84c	strace

* file.c (sprintmode): Use smaller static buffer, eliminate strlen call.
(sprinttime): Use smaller static buffer.
(printstat_sparc64): Coalesce two printing calls into one.
(printstat_powerpc32): Likewise.
(printcompat_statfs6): Likewise.
(sys_utime): Do not fetch personality_wordsize[current_personality]
repeatedly - cache it in local variable instead.
* process.c (printargv): Likewise.
* resource.c (sprintrlim): Return const char*, not char*. This allows
to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer.
(sprintrlim64): Likewise.
* strace.c (strerror): Use smaller static buffer.
(strsignal): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/file.c b/file.c
index 69b3c84..be1b1a7 100644
--- a/file.c
+++ b/file.c
@@ -666,7 +666,9 @@
 static const char *
 sprintmode(int mode)
 {
-	static char buf[64];
+	static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
+			+ sizeof(int)*3
+			+ /*paranoia:*/ 8];
 	const char *s;
 
 	if ((mode & S_IFMT) == 0)
@@ -675,13 +677,13 @@
 		sprintf(buf, "%#o", mode);
 		return buf;
 	}
-	sprintf(buf, "%s%s%s%s", s,
+	s = buf + sprintf(buf, "%s%s%s%s", s,
 		(mode & S_ISUID) ? "|S_ISUID" : "",
 		(mode & S_ISGID) ? "|S_ISGID" : "",
 		(mode & S_ISVTX) ? "|S_ISVTX" : "");
 	mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
 	if (mode)
-		sprintf(buf + strlen(buf), "|%#o", mode);
+		sprintf((char*)s, "|%#o", mode);
 	s = (*buf == '|') ? buf + 1 : buf;
 	return *s ? s : "0";
 }
@@ -690,7 +692,7 @@
 sprinttime(time_t t)
 {
 	struct tm *tmp;
-	static char buf[32];
+	static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
 
 	if (t == 0) {
 		strcpy(buf, "0");
@@ -818,8 +820,7 @@
 	if (!abbrev(tcp)) {
 		tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
 		tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
-		tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
-		tprints("}");
+		tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
 	}
 	else
 		tprints("...}");
@@ -884,8 +885,7 @@
 	if (!abbrev(tcp)) {
 		tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
 		tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
-		tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
-		tprints("}");
+		tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
 	}
 	else
 		tprints("...}");
@@ -1742,8 +1742,7 @@
 		statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
 	tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
 	tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
-	tprintf(", f_flags=%lu", (unsigned long)statbuf.f_frsize);
-	tprints("}");
+	tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
 }
 
 int
@@ -2088,6 +2087,7 @@
 		long utl[2];
 		int uti[2];
 	} u;
+	unsigned wordsize = personality_wordsize[current_personality];
 
 	if (entering(tcp)) {
 		printpath(tcp, tcp->u_arg[0]);
@@ -2096,17 +2096,13 @@
 			tprints("NULL");
 		else if (!verbose(tcp))
 			tprintf("%#lx", tcp->u_arg[1]);
-		else if (umoven(tcp, tcp->u_arg[1],
-				2 * personality_wordsize[current_personality],
-				(char *) &u) < 0)
+		else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
 			tprints("[?, ?]");
-		else if (personality_wordsize[current_personality]
-			 == sizeof u.utl[0]) {
+		else if (wordsize == sizeof u.utl[0]) {
 			tprintf("[%s,", sprinttime(u.utl[0]));
 			tprintf(" %s]", sprinttime(u.utl[1]));
 		}
-		else if (personality_wordsize[current_personality]
-			 == sizeof u.uti[0]) {
+		else if (wordsize == sizeof u.uti[0]) {
 			tprintf("[%s,", sprinttime(u.uti[0]));
 			tprintf(" %s]", sprinttime(u.uti[1]));
 		}