+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.
--- /dev/null
+// 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.
}
-/* 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. */
description = MagickGetException (wand, &severity);
image_error ("ImageMagick error: %s",
- make_string (description, strlen (description)),
+ build_string (description),
Qnil);
description = (char *) MagickRelinquishMemory (description);
}
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);
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 *);
}
/* 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;
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)))