diff options
| author | Dmitry Antipov | 2012-07-20 11:29:04 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-20 11:29:04 +0400 |
| commit | d7ea76b4f34c4e2c43bf0b1deeedde354ca540f7 (patch) | |
| tree | ac3cb2ab6d00e89542afc9a5290191e549ce1d81 /src/font.c | |
| parent | 765e61e391ee0937ff6b30510b6c4651064fe38e (diff) | |
| download | emacs-d7ea76b4f34c4e2c43bf0b1deeedde354ca540f7.tar.gz emacs-d7ea76b4f34c4e2c43bf0b1deeedde354ca540f7.zip | |
Simple wrapper for make_unibyte_string, adjust font_open_by_name.
* src/lisp.h (build_unibyte_string): New function.
* src/dosfns.c, src/fileio.c, src/fns.c, src/ftfont.c, src/process.c:
* src/sysdep.c, src/w32fns.c, src/xfns.c: Use it.
* src/font.c (font_open_by_name): Change 2nd and 3rd args to the only arg
of type Lisp_Object to avoid redundant calls to make_unibyte_string.
Adjust users accordingly.
* src/font.h (font_open_by_name): Adjust prototype.
* admin/coccinelle/unibyte_string.cocci: Semantic patch to convert from
make_unibyte_string to build_unibyte_string where appropriate.
Diffstat (limited to 'src/font.c')
| -rw-r--r-- | src/font.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/font.c b/src/font.c index 5b01a1f44d6..2c0296aa8c5 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -3350,13 +3350,13 @@ font_open_by_spec (FRAME_PTR f, Lisp_Object spec) | |||
| 3350 | found, return Qnil. */ | 3350 | found, return Qnil. */ |
| 3351 | 3351 | ||
| 3352 | Lisp_Object | 3352 | Lisp_Object |
| 3353 | font_open_by_name (FRAME_PTR f, const char *name, ptrdiff_t len) | 3353 | font_open_by_name (FRAME_PTR f, Lisp_Object name) |
| 3354 | { | 3354 | { |
| 3355 | Lisp_Object args[2]; | 3355 | Lisp_Object args[2]; |
| 3356 | Lisp_Object spec, ret; | 3356 | Lisp_Object spec, ret; |
| 3357 | 3357 | ||
| 3358 | args[0] = QCname; | 3358 | args[0] = QCname; |
| 3359 | args[1] = make_unibyte_string (name, len); | 3359 | args[1] = name; |
| 3360 | spec = Ffont_spec (2, args); | 3360 | spec = Ffont_spec (2, args); |
| 3361 | ret = font_open_by_spec (f, spec); | 3361 | ret = font_open_by_spec (f, spec); |
| 3362 | /* Do not lose name originally put in. */ | 3362 | /* Do not lose name originally put in. */ |
| @@ -4878,7 +4878,7 @@ If the named font is not yet loaded, return nil. */) | |||
| 4878 | 4878 | ||
| 4879 | if (fontset >= 0) | 4879 | if (fontset >= 0) |
| 4880 | name = fontset_ascii (fontset); | 4880 | name = fontset_ascii (fontset); |
| 4881 | font_object = font_open_by_name (f, SSDATA (name), SBYTES (name)); | 4881 | font_object = font_open_by_name (f, name); |
| 4882 | } | 4882 | } |
| 4883 | else if (FONT_OBJECT_P (name)) | 4883 | else if (FONT_OBJECT_P (name)) |
| 4884 | font_object = name; | 4884 | font_object = name; |