[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r108742: * src/alloc.c: Remove build_
From: |
Dmitry Antipov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r108742: * src/alloc.c: Remove build_string. |
Date: |
Tue, 26 Jun 2012 09:00:30 +0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108742
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-06-26 09:00:30 +0400
message:
* 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.
added:
admin/coccinelle/build_string.cocci
modified:
admin/ChangeLog
src/ChangeLog
src/alloc.c
src/image.c
src/lisp.h
src/w32proc.c
src/xterm.c
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog 2012-06-24 16:18:41 +0000
+++ b/admin/ChangeLog 2012-06-26 05:00:30 +0000
@@ -1,3 +1,8 @@
+2012-06-26 Dmitry Antipov <address@hidden>
+
+ * coccinelle/build_string.cocci: Semantic patch
+ to convert from make_string to build_string.
+
2012-06-24 Dmitry Antipov <address@hidden>
First Coccinelle semantic patch.
=== added file 'admin/coccinelle/build_string.cocci'
--- a/admin/coccinelle/build_string.cocci 1970-01-01 00:00:00 +0000
+++ b/admin/coccinelle/build_string.cocci 2012-06-26 05:00:30 +0000
@@ -0,0 +1,6 @@
+// Convert simple cases to build_string.
+@@
+identifier I;
+@@
+- make_string (I, strlen (I))
++ build_string (I)
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-06-26 02:33:51 +0000
+++ b/src/ChangeLog 2012-06-26 05:00:30 +0000
@@ -1,3 +1,13 @@
+2012-06-26 Dmitry Antipov <address@hidden>
+
+ * 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 <address@hidden>
Use sprintf return value instead of invoking strlen on result.
=== modified file 'src/alloc.c'
--- a/src/alloc.c 2012-06-22 21:17:42 +0000
+++ b/src/alloc.c 2012-06-26 05:00:30 +0000
@@ -2496,16 +2496,6 @@
}
-/* 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. */
=== modified file 'src/image.c'
--- a/src/image.c 2012-06-24 17:39:14 +0000
+++ b/src/image.c 2012-06-26 05:00:30 +0000
@@ -7570,7 +7570,7 @@
description = MagickGetException (wand, &severity);
image_error ("ImageMagick error: %s",
- make_string (description, strlen (description)),
+ build_string (description),
Qnil);
description = (char *) MagickRelinquishMemory (description);
}
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-06-26 02:33:51 +0000
+++ b/src/lisp.h 2012-06-26 05:00:30 +0000
@@ -2700,7 +2700,6 @@
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 @@
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 *);
=== modified file 'src/w32proc.c'
--- a/src/w32proc.c 2012-06-23 12:44:42 +0000
+++ b/src/w32proc.c 2012-06-26 05:00:30 +0000
@@ -777,7 +777,7 @@
}
/* 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;
=== modified file 'src/xterm.c'
--- a/src/xterm.c 2012-06-24 23:14:39 +0000
+++ b/src/xterm.c 2012-06-26 05:00:30 +0000
@@ -10036,7 +10036,7 @@
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)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r108742: * src/alloc.c: Remove build_string.,
Dmitry Antipov <=