Commit 1130ecfc authored by Dmitry Antipov's avatar Dmitry Antipov

* src/alloc.c: Remove build_string.

* src/lisp.h: Define build_string as static inline.  This provides
a better opportunity to optimize away calls to strlen when the
function is called with compile-time constant argument.
* src/image.c (imagemagick_error): Convert to build_string.
* src/w32proc.c (sys_spawnve): Likewise.
* src/xterm.c (x_term_init): Likewise.
* admin/coccinelle/build_string.cocci: Semantic patch
to convert from make_string to build_string.
parent 99027bdd
2012-06-26 Dmitry Antipov <dmantipov@yandex.ru>
* coccinelle/build_string.cocci: Semantic patch
to convert from make_string to build_string.
2012-06-24 Dmitry Antipov <dmantipov@yandex.ru>
First Coccinelle semantic patch.
......
// Convert simple cases to build_string.
@@
identifier I;
@@
- make_string (I, strlen (I))
+ build_string (I)
2012-06-26 Dmitry Antipov <dmantipov@yandex.ru>
* alloc.c: Remove build_string.
* lisp.h: Define build_string as static inline. This provides
a better opportunity to optimize away calls to strlen when the
function is called with compile-time constant argument.
* image.c (imagemagick_error): Convert to build_string.
* w32proc.c (sys_spawnve): Likewise.
* xterm.c (x_term_init): Likewise.
2012-06-26 Paul Eggert <eggert@cs.ucla.edu>
Use sprintf return value instead of invoking strlen on result.
......
......@@ -2496,16 +2496,6 @@ make_specified_string (const char *contents,
}
/* Make a string from the data at STR, treating it as multibyte if the
data warrants. */
Lisp_Object
build_string (const char *str)
{
return make_string (str, strlen (str));
}
/* Return an unibyte Lisp_String set up to hold LENGTH characters
occupying LENGTH bytes. */
......
......@@ -7570,7 +7570,7 @@ imagemagick_error (MagickWand *wand)
description = MagickGetException (wand, &severity);
image_error ("ImageMagick error: %s",
make_string (description, strlen (description)),
build_string (description),
Qnil);
description = (char *) MagickRelinquishMemory (description);
}
......
......@@ -2700,7 +2700,6 @@ EXFUN (Fmake_symbol, 1);
EXFUN (Fmake_marker, 0);
extern _Noreturn void string_overflow (void);
EXFUN (Fmake_string, 2);
extern Lisp_Object build_string (const char *);
extern Lisp_Object make_string (const char *, ptrdiff_t);
extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t);
extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t);
......@@ -2713,6 +2712,16 @@ extern Lisp_Object make_specified_string (const char *,
EXFUN (Fpurecopy, 1);
extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int);
extern Lisp_Object make_pure_c_string (const char *data);
/* Make a string from the data at STR, treating it as multibyte if the
data warrants. */
static inline Lisp_Object
build_string (const char *str)
{
return make_string (str, strlen (str));
}
extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
EXFUN (Fgarbage_collect, 0);
extern void make_byte_code (struct Lisp_Vector *);
......
......@@ -777,7 +777,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
}
/* Handle executable names without an executable suffix. */
program = make_string (cmdname, strlen (cmdname));
program = build_string (cmdname);
if (NILP (Ffile_executable_p (program)))
{
struct gcpro gcpro1;
......
......@@ -10036,7 +10036,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
const char *file = "~/.emacs.d/gtkrc";
Lisp_Object s, abs_file;
s = make_string (file, strlen (file));
s = build_string (file);
abs_file = Fexpand_file_name (s, Qnil);
if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment