diff options
| author | Andrea Corallo | 2020-04-05 22:08:17 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2020-04-05 22:08:17 +0100 |
| commit | 3608623eba9870aff8b5eb842fb8ae10f092c6bb (patch) | |
| tree | bdf007ee88dc518ee3ec62e746a2534258d4d5a4 /src | |
| parent | 4263f2fd15e8439b8e8676ebeb6ab2f7f9339025 (diff) | |
| parent | 95a7c6ec58c8c8c905f3e11be49419750737ec97 (diff) | |
| download | emacs-3608623eba9870aff8b5eb842fb8ae10f092c6bb.tar.gz emacs-3608623eba9870aff8b5eb842fb8ae10f092c6bb.zip | |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 7 | ||||
| -rw-r--r-- | src/character.c | 39 | ||||
| -rw-r--r-- | src/lisp.h | 22 |
3 files changed, 33 insertions, 35 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 8d7fdb8a607..429f7035443 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -381,11 +381,14 @@ endif | |||
| 381 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. | 381 | # Flags that might be in WARN_CFLAGS but are not valid for Objective C. |
| 382 | NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd | 382 | NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd |
| 383 | 383 | ||
| 384 | # Cajole GCC into inlining key ops even if it wouldn't normally. | ||
| 385 | KEY_OPS_CFLAGS = $(if $(filter -Og,$(CFLAGS)),-DDEFINE_KEY_OPS_AS_MACROS) | ||
| 386 | |||
| 384 | # -Demacs makes some files produce the correct version for use in Emacs. | 387 | # -Demacs makes some files produce the correct version for use in Emacs. |
| 385 | # MYCPPFLAGS is for by-hand Emacs-specific overrides, e.g., | 388 | # MYCPPFLAGS is for by-hand Emacs-specific overrides, e.g., |
| 386 | # "make MYCPPFLAGS='-DDBUS_DEBUG'". | 389 | # "make MYCPPFLAGS='-DDBUS_DEBUG'". |
| 387 | EMACS_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \ | 390 | EMACS_CFLAGS = -Demacs $(KEY_OPS_CFLAGS) $(MYCPPFLAGS) \ |
| 388 | -I$(lib) -I$(top_srcdir)/lib \ | 391 | -I. -I$(srcdir) -I$(lib) -I$(top_srcdir)/lib \ |
| 389 | $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ | 392 | $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \ |
| 390 | $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ | 393 | $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \ |
| 391 | $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ | 394 | $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \ |
diff --git a/src/character.c b/src/character.c index d71cb3f145c..a566cacb023 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -849,24 +849,22 @@ Concatenate all the argument characters and make the result a string. | |||
| 849 | usage: (string &rest CHARACTERS) */) | 849 | usage: (string &rest CHARACTERS) */) |
| 850 | (ptrdiff_t n, Lisp_Object *args) | 850 | (ptrdiff_t n, Lisp_Object *args) |
| 851 | { | 851 | { |
| 852 | ptrdiff_t i; | 852 | ptrdiff_t nbytes = 0; |
| 853 | int c; | 853 | for (ptrdiff_t i = 0; i < n; i++) |
| 854 | unsigned char *buf, *p; | ||
| 855 | Lisp_Object str; | ||
| 856 | USE_SAFE_ALLOCA; | ||
| 857 | |||
| 858 | SAFE_NALLOCA (buf, MAX_MULTIBYTE_LENGTH, n); | ||
| 859 | p = buf; | ||
| 860 | |||
| 861 | for (i = 0; i < n; i++) | ||
| 862 | { | 854 | { |
| 863 | CHECK_CHARACTER (args[i]); | 855 | CHECK_CHARACTER (args[i]); |
| 864 | c = XFIXNUM (args[i]); | 856 | nbytes += CHAR_BYTES (XFIXNUM (args[i])); |
| 857 | } | ||
| 858 | if (nbytes == n) | ||
| 859 | return Funibyte_string (n, args); | ||
| 860 | Lisp_Object str = make_uninit_multibyte_string (n, nbytes); | ||
| 861 | unsigned char *p = SDATA (str); | ||
| 862 | for (ptrdiff_t i = 0; i < n; i++) | ||
| 863 | { | ||
| 864 | eassume (CHARACTERP (args[i])); | ||
| 865 | int c = XFIXNUM (args[i]); | ||
| 865 | p += CHAR_STRING (c, p); | 866 | p += CHAR_STRING (c, p); |
| 866 | } | 867 | } |
| 867 | |||
| 868 | str = make_string_from_bytes ((char *) buf, n, p - buf); | ||
| 869 | SAFE_FREE (); | ||
| 870 | return str; | 868 | return str; |
| 871 | } | 869 | } |
| 872 | 870 | ||
| @@ -875,20 +873,13 @@ DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0, | |||
| 875 | usage: (unibyte-string &rest BYTES) */) | 873 | usage: (unibyte-string &rest BYTES) */) |
| 876 | (ptrdiff_t n, Lisp_Object *args) | 874 | (ptrdiff_t n, Lisp_Object *args) |
| 877 | { | 875 | { |
| 878 | ptrdiff_t i; | 876 | Lisp_Object str = make_uninit_string (n); |
| 879 | Lisp_Object str; | 877 | unsigned char *p = SDATA (str); |
| 880 | USE_SAFE_ALLOCA; | 878 | for (ptrdiff_t i = 0; i < n; i++) |
| 881 | unsigned char *buf = SAFE_ALLOCA (n); | ||
| 882 | unsigned char *p = buf; | ||
| 883 | |||
| 884 | for (i = 0; i < n; i++) | ||
| 885 | { | 879 | { |
| 886 | CHECK_RANGED_INTEGER (args[i], 0, 255); | 880 | CHECK_RANGED_INTEGER (args[i], 0, 255); |
| 887 | *p++ = XFIXNUM (args[i]); | 881 | *p++ = XFIXNUM (args[i]); |
| 888 | } | 882 | } |
| 889 | |||
| 890 | str = make_string_from_bytes ((char *) buf, n, p - buf); | ||
| 891 | SAFE_FREE (); | ||
| 892 | return str; | 883 | return str; |
| 893 | } | 884 | } |
| 894 | 885 | ||
diff --git a/src/lisp.h b/src/lisp.h index 2f719b1f03e..1a5215df394 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -411,15 +411,19 @@ typedef EMACS_INT Lisp_Word; | |||
| 411 | # define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a) & ~VALMASK)) | 411 | # define lisp_h_XTYPE(a) ((enum Lisp_Type) (XLI (a) & ~VALMASK)) |
| 412 | #endif | 412 | #endif |
| 413 | 413 | ||
| 414 | /* When compiling via gcc -O0, define the key operations as macros, as | 414 | /* When DEFINE_KEY_OPS_AS_MACROS, define key operations as macros to |
| 415 | Emacs is too slow otherwise. To disable this optimization, compile | 415 | cajole the compiler into inlining them; otherwise define them as |
| 416 | with -DINLINING=false. */ | 416 | inline functions as this is cleaner and can be more efficient. |
| 417 | #if (defined __NO_INLINE__ \ | 417 | The default is true if the compiler is GCC-like and if function |
| 418 | && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__ \ | 418 | inlining is disabled because the compiler is not optimizing or is |
| 419 | && ! (defined INLINING && ! INLINING)) | 419 | optimizing for size. Otherwise the default is false. */ |
| 420 | # define DEFINE_KEY_OPS_AS_MACROS true | 420 | #ifndef DEFINE_KEY_OPS_AS_MACROS |
| 421 | #else | 421 | # if (defined __NO_INLINE__ \ |
| 422 | # define DEFINE_KEY_OPS_AS_MACROS false | 422 | && ! defined __OPTIMIZE__ && ! defined __OPTIMIZE_SIZE__) |
| 423 | # define DEFINE_KEY_OPS_AS_MACROS true | ||
| 424 | # else | ||
| 425 | # define DEFINE_KEY_OPS_AS_MACROS false | ||
| 426 | # endif | ||
| 423 | #endif | 427 | #endif |
| 424 | 428 | ||
| 425 | #if DEFINE_KEY_OPS_AS_MACROS | 429 | #if DEFINE_KEY_OPS_AS_MACROS |