diff options
| author | Paul Eggert | 2012-07-05 11:35:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-05 11:35:48 -0700 |
| commit | 38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch) | |
| tree | a69e1a571495d6ca1c034359d7c995639774ab9b /src/fontset.c | |
| parent | 6dd5a677dbf794eedaa8325c46d57ac041373361 (diff) | |
| download | emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.tar.gz emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.zip | |
More xmalloc and related cleanup.
* alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
* callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
* doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
* font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
* gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
* nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
* regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
* sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
* xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
* xterm.c:
Omit needless casts involving void * pointers and allocation.
Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
as the former is more robust if P's type is changed.
Prefer xzalloc to xmalloc + memset 0.
Simplify malloc-or-realloc to realloc.
Don't worry about xmalloc returning a null pointer.
Prefer xstrdup to xmalloc + strcpy.
* editfns.c (Fmessage_box): Grow message_text by at least 80 when
growing it.
* keyboard.c (apply_modifiers_uncached): Prefer local array to
alloca of a constant.
Diffstat (limited to 'src/fontset.c')
| -rw-r--r-- | src/fontset.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/fontset.c b/src/fontset.c index da54bca2a5c..cfaa24124f1 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1082,9 +1082,9 @@ fontset_pattern_regexp (Lisp_Object pattern) | |||
| 1082 | we convert "*" to "[^-]*" which is much faster in regular | 1082 | we convert "*" to "[^-]*" which is much faster in regular |
| 1083 | expression matching. */ | 1083 | expression matching. */ |
| 1084 | if (ndashes < 14) | 1084 | if (ndashes < 14) |
| 1085 | p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); | 1085 | p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1); |
| 1086 | else | 1086 | else |
| 1087 | p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); | 1087 | p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1); |
| 1088 | 1088 | ||
| 1089 | *p1++ = '^'; | 1089 | *p1++ = '^'; |
| 1090 | for (p0 = SDATA (pattern); *p0; p0++) | 1090 | for (p0 = SDATA (pattern); *p0; p0++) |
| @@ -1893,8 +1893,7 @@ format is the same as above. */) | |||
| 1893 | 1893 | ||
| 1894 | /* Recode fontsets realized on FRAME from the base fontset FONTSET | 1894 | /* Recode fontsets realized on FRAME from the base fontset FONTSET |
| 1895 | in the table `realized'. */ | 1895 | in the table `realized'. */ |
| 1896 | realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object) | 1896 | realized[0] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table)); |
| 1897 | * ASIZE (Vfontset_table)); | ||
| 1898 | for (i = j = 0; i < ASIZE (Vfontset_table); i++) | 1897 | for (i = j = 0; i < ASIZE (Vfontset_table); i++) |
| 1899 | { | 1898 | { |
| 1900 | elt = FONTSET_FROM_ID (i); | 1899 | elt = FONTSET_FROM_ID (i); |
| @@ -1905,8 +1904,7 @@ format is the same as above. */) | |||
| 1905 | } | 1904 | } |
| 1906 | realized[0][j] = Qnil; | 1905 | realized[0][j] = Qnil; |
| 1907 | 1906 | ||
| 1908 | realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object) | 1907 | realized[1] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table)); |
| 1909 | * ASIZE (Vfontset_table)); | ||
| 1910 | for (i = j = 0; ! NILP (realized[0][i]); i++) | 1908 | for (i = j = 0; ! NILP (realized[0][i]); i++) |
| 1911 | { | 1909 | { |
| 1912 | elt = FONTSET_DEFAULT (realized[0][i]); | 1910 | elt = FONTSET_DEFAULT (realized[0][i]); |