diff options
| author | Mattias EngdegÄrd | 2024-07-09 10:01:03 +0200 |
|---|---|---|
| committer | Mattias EngdegÄrd | 2024-07-09 18:31:46 +0200 |
| commit | 7e358aa706f9dbfce24304e8a05904538615537f (patch) | |
| tree | 60263694e626332211914fcbca8048bbbd23072b /src | |
| parent | acfc3884bf58f7b407c42c8751affbcb365eb105 (diff) | |
| download | emacs-7e358aa706f9dbfce24304e8a05904538615537f.tar.gz emacs-7e358aa706f9dbfce24304e8a05904538615537f.zip | |
Use cheaper string constructors
* src/coding.c (make_string_from_utf8):
* src/fileio.c (file_name_directory):
* src/lread.c (Fintern):
* src/gnutls.c (Fgnutls_format_certificate):
Use `make_multibyte_string` and `make_unibyte_string` instead of
more expensive `make_specified_string` and `make_string_from_bytes`.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 2 | ||||
| -rw-r--r-- | src/fileio.c | 2 | ||||
| -rw-r--r-- | src/gnutls.c | 3 | ||||
| -rw-r--r-- | src/lread.c | 4 |
4 files changed, 5 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index b48164efc69..e42b6b6e720 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -6365,7 +6365,7 @@ make_string_from_utf8 (const char *text, ptrdiff_t nbytes) | |||
| 6365 | /* If TEXT is a valid UTF-8 string, we can convert it to a Lisp | 6365 | /* If TEXT is a valid UTF-8 string, we can convert it to a Lisp |
| 6366 | string directly. Otherwise, we need to decode it. */ | 6366 | string directly. Otherwise, we need to decode it. */ |
| 6367 | if (chars == nbytes || bytes == nbytes) | 6367 | if (chars == nbytes || bytes == nbytes) |
| 6368 | return make_specified_string (text, chars, nbytes, true); | 6368 | return make_multibyte_string (text, chars, nbytes); |
| 6369 | else | 6369 | else |
| 6370 | { | 6370 | { |
| 6371 | struct coding_system coding; | 6371 | struct coding_system coding; |
diff --git a/src/fileio.c b/src/fileio.c index 7afe3e75737..fa280f2db00 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -523,7 +523,7 @@ file_name_directory (Lisp_Object filename) | |||
| 523 | else | 523 | else |
| 524 | { | 524 | { |
| 525 | dostounix_filename (beg); | 525 | dostounix_filename (beg); |
| 526 | tem_fn = make_specified_string (beg, -1, p - beg, 0); | 526 | tem_fn = make_unibyte_string (beg, p - beg); |
| 527 | } | 527 | } |
| 528 | SAFE_FREE (); | 528 | SAFE_FREE (); |
| 529 | return tem_fn; | 529 | return tem_fn; |
diff --git a/src/gnutls.c b/src/gnutls.c index 3ff7f21d5a5..334d1d47eb6 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -1646,8 +1646,7 @@ string representation. */) | |||
| 1646 | emacs_gnutls_strerror (err)); | 1646 | emacs_gnutls_strerror (err)); |
| 1647 | } | 1647 | } |
| 1648 | 1648 | ||
| 1649 | Lisp_Object result = make_string_from_bytes ((char *) out.data, out.size, | 1649 | Lisp_Object result = make_unibyte_string ((char *) out.data, out.size); |
| 1650 | out.size); | ||
| 1651 | gnutls_free (out.data); | 1650 | gnutls_free (out.data); |
| 1652 | gnutls_x509_crt_deinit (crt); | 1651 | gnutls_x509_crt_deinit (crt); |
| 1653 | 1652 | ||
diff --git a/src/lread.c b/src/lread.c index c3b0e8a3ef5..c1f309866c8 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -5025,8 +5025,8 @@ it defaults to the value of `obarray'. */) | |||
| 5025 | { | 5025 | { |
| 5026 | if (longhand) | 5026 | if (longhand) |
| 5027 | { | 5027 | { |
| 5028 | tem = intern_driver (make_specified_string (longhand, longhand_chars, | 5028 | tem = intern_driver (make_multibyte_string (longhand, longhand_chars, |
| 5029 | longhand_bytes, true), | 5029 | longhand_bytes), |
| 5030 | obarray, tem); | 5030 | obarray, tem); |
| 5031 | xfree (longhand); | 5031 | xfree (longhand); |
| 5032 | } | 5032 | } |