Skip to content
Permalink
Browse files
vsprintf: Move space out of string literals in fourcc_string()
The literals "big-endian" and "little-endian" may be potentially
occurred in other places. Dropping space allows linker to
"compress" them by using only a single copy.

Rasmus suggested, while at it, replacing strcpy() + strlen() by
p = stpcpy(), which is done here as well.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
  • Loading branch information
andy-shev authored and intel-lab-lkp committed Jan 24, 2022
1 parent ccad509 commit f1895edcabdc5dae0528ffff9c3cb665a937223d
Showing 1 changed file with 2 additions and 2 deletions.
@@ -1790,8 +1790,8 @@ char *fourcc_string(char *buf, char *end, const u32 *fourcc,
*p++ = isascii(c) && isprint(c) ? c : '.';
}

strcpy(p, orig & BIT(31) ? " big-endian" : " little-endian");
p += strlen(p);
*p++ = ' ';
p = stpcpy(p, orig & BIT(31) ? "big-endian" : "little-endian");

*p++ = ' ';
*p++ = '(';

0 comments on commit f1895ed

Please sign in to comment.