diff options
| author | Paul Eggert | 2025-01-26 22:15:50 -0800 |
|---|---|---|
| committer | Paul Eggert | 2025-01-26 23:05:54 -0800 |
| commit | f8b8dddce90f5cbf6ca0be2e72b4e11cdcf581fe (patch) | |
| tree | 93bc8563d254a40b10f6f52949edee7c809f389b | |
| parent | 8d8272d02e38ee3624cd3f16767f3c60fb3383ea (diff) | |
| download | emacs-f8b8dddce90f5cbf6ca0be2e72b4e11cdcf581fe.tar.gz emacs-f8b8dddce90f5cbf6ca0be2e72b4e11cdcf581fe.zip | |
Minor format_string tuneup
* src/comp.c (format_string): Prefer strcpy to doing things by hand
in a place where strcpy is easier to read, generates
more-efficient code, and similar parts of Emacs do strcpy.
| -rw-r--r-- | src/comp.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/comp.c b/src/comp.c index 2603a2f4334..ce59fdd80e3 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -720,11 +720,7 @@ format_string (const char *format, ...) | |||
| 720 | va_start (va, format); | 720 | va_start (va, format); |
| 721 | int res = vsnprintf (scratch_area, sizeof (scratch_area), format, va); | 721 | int res = vsnprintf (scratch_area, sizeof (scratch_area), format, va); |
| 722 | if (res >= sizeof (scratch_area)) | 722 | if (res >= sizeof (scratch_area)) |
| 723 | { | 723 | strcpy (scratch_area + sizeof scratch_area - 4, "..."); |
| 724 | scratch_area[sizeof (scratch_area) - 4] = '.'; | ||
| 725 | scratch_area[sizeof (scratch_area) - 3] = '.'; | ||
| 726 | scratch_area[sizeof (scratch_area) - 2] = '.'; | ||
| 727 | } | ||
| 728 | va_end (va); | 724 | va_end (va); |
| 729 | return scratch_area; | 725 | return scratch_area; |
| 730 | } | 726 | } |