Skip to content

Commit

Permalink
vsprintf: Move space out of string literals in fourcc_string()
Browse files Browse the repository at this point in the history
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 f1895ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++ = '(';
Expand Down

0 comments on commit f1895ed

Please sign in to comment.